Intelligent anti-crawler mechanism bypassing method and device

By constructing a deep Q-network with an attention mechanism in the web crawler, and combining it with a preset time-dependent formula and historical behavior sequence, a dynamic adjustment strategy is generated. This solves the problem that existing technologies struggle to cope with complex anti-crawler mechanisms in bidding information collection, and achieves efficient and stable information acquisition.

CN121188264APending Publication Date: 2025-12-23SHIBO TECH (WUHAN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511193217.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-25
Publication Date
2025-12-23

AI Technical Summary

Technical Problem

Existing methods for collecting bidding information quality are insufficient to effectively cope with complex anti-crawler mechanisms. In particular, traditional crawlers that rely on static rules or simple randomization strategies cannot adapt to the dynamic changes in anti-crawler mechanisms, leading to wasted resources or an increased risk of being blocked.

Method used

A historical behavior sequence is constructed based on the actions and rewards of the crawler at a preset time. A deep Q-network with an attention mechanism is established. The path planning of the bidding information quality and historical behavior sequence is performed by the preset time-dependent formula and the deep Q-network to generate a crawler adjustment strategy. The effectiveness of the strategy is judged by the adjusted bidding information quality.

Benefits of technology

It improves the efficiency and quality of bidding information acquisition, reduces the risk of being blocked, effectively adapts to the dynamic changes of anti-crawler mechanisms, and enhances prediction accuracy and the continuity of information collection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121188264A_ABST
    Figure CN121188264A_ABST
Patent Text Reader

Abstract

The invention relates to an intelligent anti-crawler mechanism bypassing method and device. The method comprises the steps that a historical behavior sequence is constructed based on actions and rewards of a crawler in preset time; when a browsing instruction is received, obtaining first beacon information quality at the current moment according to the browsing instruction; according to a preset time dependence formula and a deep Q network, path planning is carried out on the first beacon information quality and the historical behavior sequence to obtain a crawler adjustment strategy, so that the historical behavior sequence is associated with the current first beacon information quality, and time dependence is also considered; after adjustment is carried out according to the crawler adjustment strategy, second beacon information quality is collected, whether the crawler adjustment strategy is valid or not is judged according to the second beacon information quality, and if yes, it is confirmed that the anti-crawler mechanism is completed; therefore, targeted detection and adjustment are performed on the crawler adjustment strategy, the dynamic change characteristics of the anti-crawler mechanism are effectively adapted, the prediction accuracy is improved, the banned risk is reduced, and the index information acquisition efficiency and quality are improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of web crawlers, and in particular to an intelligent anti-crawler mechanism bypass method and device. BACKGROUND

[0002] Tender information quality (such as tender announcements and procurement data) is crucial for business decisions, but the websites where it is located usually deploy multi-level anti-crawler mechanisms, such as IP blocking, dynamic CAPTCHA, and behavior pattern detection.

[0003] Existing methods for collecting tender information quality are difficult to effectively cope with complex anti-crawler mechanisms. Specifically, traditional crawlers rely on static rules or simple randomization strategies, which cannot adapt to the dynamic changes of anti-crawler mechanisms. Although some reinforcement learning methods have improved, there are still the following problems: 1) the modeling of anti-crawler strategies is too simple, ignoring their time dependence and contextual relevance; 2) the action selection lacks pertinence, leading to resource waste or increasing the risk of being blocked. These problems make it difficult for existing methods to effectively collect while avoiding anti-crawler mechanisms.

[0004] Therefore, there is an urgent need to propose an intelligent anti-crawler mechanism bypass method and device to solve the technical problem that existing methods for collecting tender information quality are difficult to effectively cope with complex anti-crawler mechanisms. SUMMARY

[0005] Therefore, it is necessary to provide an intelligent anti-crawler mechanism bypass method and device to solve the technical problem that existing methods for collecting tender information quality are difficult to effectively cope with complex anti-crawler mechanisms.

[0006] To solve the above problems, in a first aspect, the present application provides an intelligent anti-crawler mechanism bypass method, comprising: constructing a historical behavior sequence based on the actions and rewards of the crawler at a preset time, and establishing a deep Q network with an attention mechanism; when a browsing instruction is received, obtaining first tender information quality at the current time according to the browsing instruction; planning a path for the first tender information quality and the historical behavior sequence according to a preset time-dependent formula and the deep Q network, to obtain a crawler adjustment strategy; after adjusting according to the crawler adjustment strategy, collecting second tender information quality, and determining whether the crawler adjustment strategy is effective according to the second tender information quality, if so, confirming that the anti-crawler mechanism is complete.

[0007] In a possible implementation, the first tender information quality at the current time is obtained according to the browsing instruction, comprising: According to the browsing instruction, a browsing content at a current time is acquired, and a target information template is set; According to the browsing content and the target information template, first information quality is obtained.

[0008] In a possible implementation, the path planning on the first information quality and the historical behavior sequence according to the preset time-dependent formula and the deep Q network obtains a crawler adjustment strategy, including: According to the preset time-dependent formula, the first information quality is processed to obtain a time-dependent result; According to the deep Q network, the first information quality and the historical behavior sequence are weighted to obtain a weighted state; According to the time-dependent result and the weighted state, path planning is performed to obtain a crawler adjustment strategy.

[0009] In a possible implementation, the processing of the first information quality according to the preset time-dependent formula to obtain a time-dependent result includes: The number of times of crawler actions being banned and not being banned within a preset time is acquired, and a ban probability is determined according to the number of times; According to a preset reward function, a preset driving preference coefficient, the ban probability and the first information quality are calculated to obtain a similarity threshold; It is judged whether the first information quality is greater than the similarity threshold; If not, the first information quality is processed according to the preset time-dependent formula to obtain a first time-dependent result; the third information quality at the next time is acquired, and the first time-dependent result and the third information quality are processed according to the preset time-dependent formula and the judgment of the similarity threshold; If yes, the first information quality is processed according to the preset time-dependent formula to obtain a time-dependent result.

[0010] In a possible implementation, the weighted calculation of the first information quality and the historical behavior sequence according to the deep Q network to obtain a weighted state includes: According to the historical behavior sequence and the first information quality, a state space is set; According to the current task query amount in the first information quality and the current task query amount at each time in the historical behavior sequence within the preset time, and a preset state feature vector, a feature weight of each state feature is determined; All feature weights within the preset time and the state space are weighted to obtain a weighted state.

[0011] In a possible implementation, the path planning according to the time-dependent result and the weighting state to obtain a crawler adjustment strategy comprises: setting an action set; performing path planning according to the weighting state, the time-dependent result and the action set to determine a predicted action value; determining the crawler adjustment strategy according to the predicted action value and a preset strategy.

[0012] In a possible implementation, the judging whether the crawler adjustment strategy is effective according to the second information quality comprises: updating the ban probability according to the second information quality to obtain a target ban probability; calculating the second information quality and the target ban probability according to a preset reward function to obtain a reward value; judging whether the reward value is greater than a preset threshold; if yes, confirming that the crawler adjustment strategy is effective; if no, confirming that the crawler adjustment strategy is ineffective.

[0013] In a possible implementation, after confirming that the crawler adjustment strategy is ineffective, the method further comprises: performing path planning on the second information quality according to the preset time-dependent formula and the deep Q network to obtain a new crawler adjustment strategy; judging whether the new crawler adjustment strategy is effective after adjusting the crawler according to the new crawler adjustment strategy; if yes, confirming that the anti-crawler mechanism is completed.

[0014] In a possible implementation, the preset time-dependent formula is calculated as follows:

[0015] In the formula, t is a time point, is a quality of collected first information at the time point t; is a quality of collected second information at the time point t; is a cost of being banned or triggering defense, and the cost of being banned is negative, and the cost of not being banned is positive; is a weight coefficient, is a discount factor at the time point t; is a time-dependent result at the time point t; is a time-dependent result at the time point t.

[0016] ​​​​In a second aspect, the present application also provides an intelligent anti-crawler mechanism bypass device, comprising: A model establishing module is configured to construct a historical behavior sequence based on the actions and rewards of the crawler at a preset time and establish a deep Q network with an attention mechanism. A quality calculating module is configured to acquire the first information quality at the current time according to the browsing instruction when the browsing instruction is received. A strategy determining module is configured to perform path planning on the first information quality and the historical behavior sequence according to a preset time-dependent formula and the deep Q network, and obtain a crawler adjustment strategy. A strategy judging module is configured to collect the second information quality after the adjustment according to the crawler adjustment strategy, judge whether the crawler adjustment strategy is effective according to the second information quality, and confirm that the anti-crawler mechanism is completed if yes.

[0017] The present application has the following beneficial effects: the historical behavior sequence is constructed based on the actions and rewards of the crawler at a preset time, and the deep Q network with an attention mechanism is established; the first information quality at the current time is acquired according to the browsing instruction when the browsing instruction is received; the path planning is performed on the first information quality and the historical behavior sequence according to a preset time-dependent formula and the deep Q network, and the crawler adjustment strategy is obtained, so that the historical behavior sequence and the current first information quality are associated, and the time dependence is also considered; further, the second information quality is collected after the adjustment according to the crawler adjustment strategy, the crawler adjustment strategy is judged according to the second information quality, and the anti-crawler mechanism is confirmed to be completed if yes; thus, the crawler adjustment strategy is detected and adjusted specifically, the dynamic change characteristics of the anti-crawler mechanism are effectively adapted, the prediction accuracy is improved, the risk of being banned is reduced, and the information acquisition efficiency and quality are improved. BRIEF DESCRIPTION OF DRAWINGS

[0018] Figure 1 An embodiment flowchart of the intelligent anti-crawler mechanism bypass method provided by the present application is shown. Figure 2 An embodiment flowchart of step S103 in the present application is shown. Figure 1 Figure 3 An embodiment flowchart of step S201 in the present application is shown. Figure 2 Figure 4 An embodiment flowchart of step S202 in the present application is shown. Figure 2 Figure 5 An embodiment structure diagram of the intelligent anti-crawler mechanism bypass device provided by the present application is shown. DETAILED DESCRIPTION ​​​

[0019] The preferred embodiments of the present application will be described in detail below with reference to the drawings, which form a part of this application. The drawings and the associated descriptions are provided to illustrate the preferred embodiments of the present application and to provide a comprehensible description of the principles of the present application. Therefore, it will be apparent to those skilled in the art that any modifications made to the preferred embodiments of the present application should not be regarded as a departure from the scope of the present application.

[0020] As shown in the specific embodiment of the present application, a method for bypassing an intelligent anti-crawler mechanism is disclosed, comprising: Figure 1 S101, constructing a historical behavior sequence based on the actions and rewards of the crawler at a preset time, and establishing a deep Q network of attention mechanism.

[0021] The method for bypassing an intelligent anti-crawler mechanism provided by the embodiments of the present application can be applied to a system for bypassing an intelligent anti-crawler mechanism, wherein the system for bypassing an intelligent anti-crawler mechanism can be a software system running on a terminal device, and the terminal device can be a server, a tablet computer, an augmented reality (AR) / virtual reality (VR) device, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), a mobile phone, and the like. The embodiments of the present application do not limit the specific type of the terminal device.

[0022] The preset time-dependent formula can be a formula in a non-stationary dynamic game model, and the non-stationary dynamic game model refers to a mathematical model capable of reflecting the interactive relationship between the crawler and the anti-crawler system changing over time. Specifically, the non-stationary dynamic game model can be implemented by using a Markov game framework combined with a time decay factor to capture the time-dependent feature in dynamic confrontation. The historical behavior sequence can be the actions and rewards of the crawler at the preset time, and the historical behavior sequence On the basis of the preset time-dependent formula, the embodiments of the present application use a deep Q network (DQN) as a decision tool for the crawler, and introduce an adversarial attention mechanism for optimization to construct an AA-DQN (attention mechanism deep Q network). The purpose of this design is to improve the decision accuracy and execution efficiency of the crawler in a high-dimensional dynamic environment. The attention mechanism deep Q network refers to a neural network structure with feature weight distribution capability, and can be implemented by using a multi-head self-attention mechanism combined with a long short-term memory network to extract key state features.

[0023] S102, when receiving a browsing instruction, obtaining first signal information quality at the current time according to the browsing instruction.

[0024] ​The intelligent anti-crawler mechanism bypass system of the embodiment of the application can receive information sent by a user in real time, and when receiving a browsing instruction sent by the user, can collect the current time browsing content of the user according to the browsing instruction, so that the first information quality of the current time can be obtained.

[0025] S103, according to the preset time-dependent formula and the deep Q network, path planning is performed on the first information quality and the historical behavior sequence, and a crawler adjustment strategy is obtained.

[0026] The path planning refers to a process of generating an optimal action sequence according to a current environment state, and can be specifically implemented by combining a Q-learning algorithm with a Monte Carlo tree search, is used to balance the relationship between exploration and utilization, and can be planned by the state of the crawler in the historical behavior sequence and the state of the crawler at the current time.

[0027] S104, after adjusting according to the crawler adjustment strategy, the second information quality is collected, and whether the crawler adjustment strategy is effective is judged according to the second information quality, if yes, it is confirmed that the anti-crawler mechanism is completed.

[0028] The information quality refers to an evaluation index reflecting the effectiveness of data collection, and can be specifically calculated by weighting three dimensions of information integrity, update timeliness and data consistency, and is used to guide the adjustment direction of the strategy.

[0029] Specifically, the historical behavior sequence can be established by the behavior of the crawler within a preset time, when receiving the browsing instruction, the information quality at the current time is obtained as the initial input. The state transition probability on the time sequence is calculated by the preset time-dependent formula, and the multi-dimensional features are dynamically weighted by combining the attention network, to generate a comprehensive state representation containing time dependence and feature association. Based on the state representation, an optimal action sequence is searched in the action space, to generate a composite adjustment scheme containing access frequency adjustment, request header modification and verification code cracking strategy. After executing the adjustment strategy, the information quality improvement amplitude is verified by secondary collection, and when reaching a preset threshold, the strategy is determined to be effective, otherwise the path planning is performed again.

[0030] Compared with the prior art, the embodiment provided based on the action of the crawler at the preset time and the reward constructs the historical behavior sequence and establishes the deep Q network of the attention mechanism; when the browsing instruction is received, the first information quality of the current time is obtained according to the browsing instruction; the path planning is performed on the first information quality of the first information quality and the historical behavior sequence according to the preset time dependence formula and the deep Q network, and the crawler adjustment strategy is obtained, so that the historical behavior sequence and the current first information quality of the first information quality are associated, and the time dependence is also considered; further, after the adjustment according to the crawler adjustment strategy, the second information quality of the second information quality is collected, and whether the crawler adjustment strategy is effective is judged according to the second information quality of the second information quality, if yes, it is confirmed that the anti-crawler mechanism is completed; so that the crawler adjustment strategy is detected and adjusted, the dynamic change characteristics of the anti-crawler mechanism are effectively adapted, the prediction accuracy is improved, the risk of being banned is reduced, and the information acquisition efficiency and quality are improved.

[0031] Through the above technical solution, the application can effectively identify the time-varying law of the anti-crawler strategy, dynamically adjust the crawler behavior mode, reduce the probability of triggering the defense mechanism while ensuring the integrity of the information acquisition, and improve the data acquisition persistence and stability.

[0032] In some embodiments of the application, step S102 comprises: According to the browsing instruction, the browsing content of the current time is obtained, and a target information template is set.

[0033] The browsing content refers to the real-time page data obtained by analyzing the access address and parameters contained in the browsing instruction, which can be realized by simulating the browser access behavior by using the HTTP request library, for example, setting the User-Agent field in the request header to simulate the real user equipment. The target information template refers to the pre-defined structured data extraction rule, which can be realized by using the regular expression or XPath path matching method, and is used to identify the title, publication time, procurement amount and other key fields of the bidding announcement in the page.

[0034] The first information quality is obtained according to the browsing content and the target information template.

[0035] The first information quality refers to the matching degree of the current page content and the target information template, which can be realized by calculating the coverage rate or integrity index of the template field in the page, for example, the proportion of the pre-set field in the template that is successfully extracted in the page.

[0036] Specifically, when the system receives a user-triggered browsing instruction, the target URL and access parameters contained in the instruction are first parsed, and a request is sent to the target server by simulating the behavior of a browser. After obtaining the page response data at the current time, a pre-generated target information template is loaded, which defines the field type, location characteristics, and verification rules of the information to be collected. By comparing the real-time page content with the template item by item, the matching degree score of each field is calculated and a comprehensive quality score is generated. For example, when the template contains ten preset fields and there are eight complete matching items in the page, the quality of the first information can be quantified as a matching rate of 80%. The quantification of the quality of the first information is shown in formula (1): (1) In the formula, Q is the quality of the first information, C is the browsing content at the current time, T is the target information template.

[0037] Through the above technical solution, the present application can effectively identify the completeness of the information in the current page that meets the business needs, avoid invalid data collection caused by changes in page structure or anti-crawling mechanism interference, and provide reliable initial state evaluation basis for subsequent path planning, thereby reducing the risk of triggering the anti-crawling mechanism due to incomplete data collection.

[0038] In some embodiments of the present application, as shown in Figure 2 Step S103 includes: S201, processing the quality of the first information according to a preset time-dependent formula to obtain a time-dependent result.

[0039] The time-dependent result refers to a processing result with time correlation generated based on the historical action sequence and the current state, which can be calculated by combining the statistical relationship between the number of times the crawler action is banned and the number of times it is not banned within a preset time with a preset reward function, and is used to reflect the time sensitivity of the anti-crawler mechanism.

[0040] S202, calculating the weight of the first information quality and the historical behavior sequence according to the deep Q network to obtain a weighted state.

[0041] The weighted state refers to a representation after dynamically allocating weights to each feature in the state space, which can be calculated by combining the relevance analysis of actions, rewards, and current task query volume in historical behavior with a state feature vector, and is used to enhance the decision-making influence of key features.

[0042] S203, performing path planning according to the time-dependent result and the weighted state to obtain a crawler adjustment strategy.

[0043] Specifically, when the first information quality is input, a preset time-dependent formula analyzes the action ban probability in a preset time window, generates a similarity threshold value by combining a preset driving preference coefficient and the information quality, and iteratively calculates a time-dependent result according to a threshold value judgment result. At the same time, a deep Q network constructs a state space based on the current task query amount and data in the historical behavior sequence, dynamically weights the state features through a feature weight distribution mechanism, and generates a weighted state reflecting the current environmental features. The time-dependent result and the weighted state are jointly input into a path planning module, the predicted action value of the action set is evaluated, and finally an adjustment strategy suitable for the current anti-crawler strategy is generated.

[0044] Through the above technical solutions, the present application can generate a crawler adjustment strategy with time adaptability and feature pertinence for the dynamic anti-crawler mechanism in the information quality collection scene, effectively reduce the risk of ban caused by strategy rigidity, and improve the accuracy and environmental adaptability of path planning decision in the information quality collection process.

[0045] In some embodiments of the present application, as shown in Figure 3 Step S201 includes: S301, obtaining the number of times of ban and unban of crawler actions in a preset time, and determining the ban probability according to the number of times.

[0046] The ban probability refers to the probability of triggering the anti-crawler mechanism by the crawler in the preset time range, which can be realized by using the ratio of the number of times of ban to the total number of requests in a sliding window, and is used to quantify the strictness of the current anti-crawler strategy.

[0047] Specifically, the number of times of ban and the number of times of unban in a preset time can be obtained, and the ban probability is calculated according to the total number of times of ban and unban and the number of times of ban, and the calculation is as shown in formula (2): (2) S302, calculating the preset driving preference coefficient, the ban probability and the first information quality according to the preset reward function to obtain the similarity threshold value.

[0048] The similarity threshold value refers to the matching critical value of the information quality and the preset standard, which can be obtained by linear or nonlinear operation of the driving preference coefficient, the ban probability and the information quality through the preset reward function, and is used to judge whether the current collection path needs to be adjusted.

[0049] The preset reward function is as shown in formula (3): (3) In the formula, , the first information quality according to formula (1), and is a driving preference coefficient, a parameter between 0 and 1, which can be set according to actual conditions, for example, when the comparison is biased towards banning, can be set to be large, and if the bias is towards not banning, can be set to be large.

[0050] Thus, the first information quality, the preset driving preference coefficient and the ban probability can be brought into formula (3) for calculation to obtain the similarity threshold.

[0051] In the embodiment of the application, the scene is: at time t=5 (October 1, 2023 10:20), the crawler collects page M5 (a certain bidding announcement page), and the semantic perception reward is calculated.

[0052] Example: The BERT model is used to calculate the semantic similarity between the page and the target task (“bidding announcement”): Sim(P, M)=0.85.

[0053] Ban probability (based on the last three actions: t=2 banned, t=3,4 not banned): P ban,5 =31≈0.333; Reward calculation: Parameters: λ1=1, λ2=0.5, λ3=0.2; W5=λ1×Sim(P5,M)−λ2×P ban,5 =1×0.85−0.5×0.333≈0.85−0.1665≈0.6835.

[0054] Result: the reward function encourages the collection of high-quality information (high similarity), punishes the risk of banning, guides the crawler to optimize behavior, and improves the efficiency of the supplier game.

[0055] S303, judge whether the first information quality is greater than the similarity threshold; S304, if not, process the first information quality according to the preset time-dependent formula to obtain the first time-dependent result; obtain the third information quality at the next time, and process the first time-dependent result and the third information quality according to the preset time-dependent formula and the similarity threshold. S305, if yes, process the first information quality according to the preset time-dependent formula to obtain the time-dependent result.

[0056] After the similarity threshold is calculated, it can be judged whether the first information quality is greater than the similarity threshold , that is ​​If yes, the first information quality is processed according to a preset time-dependent formula to obtain a time-dependent result, and the specific process is as follows: In order to accurately describe the dynamic confrontation between the crawler and the anti-crawler, the embodiment of the application first constructs a non-stationary dynamic game model. The model is based on the time dimension, sets a preset time-dependent formula, and comprehensively considers the strategy evolution and behavior prediction of both parties, and specifically includes the following contents: (1) Define the participants: Crawler (collection party): The goal is to efficiently and covertly collect information.

[0057] Anti-crawling mechanism (defense party): The goal is to detect and prevent the collection behavior of the crawler.

[0058] (2) Define the crawler strategy set : including IP switching (hiding identity by changing IP address) and request frequency adjustment (dynamically controlling access speed to reduce the probability of being detected) and other strategies.

[0059] (3) Define the anti-crawler strategy set : including detection threshold adjustment (dynamically updating detection rules according to traffic characteristics) and IP address unblocking (unblocking IP under certain conditions) and other countermeasures.

[0060] (4) Define the time-dependent effect, that is, the preset time-dependent formula as shown in formula (4): (4) In the formula, is the quality of the first information collected at time ; is the cost of being banned or triggering defense at time , and the banned value is negative (such as -1), indicating the loss (such as IP replacement cost or collection interruption time) caused by the ban, and the unblocked value is positive (such as 1), indicating the cost of normal operation or minimum cost (1 indicating slight income); is a weight coefficient, is a discount factor at time ; is the time-dependent result at time , that is, the time-dependent result of the last time, if the current time is the initial time, there is no last time, is 0. Through the model, the crawler can dynamically adjust the strategy according to the real-time feedback of the anti-crawler.

[0061] In the embodiments of the present application, if the first information quality is less than or equal to the similarity threshold, the first information quality can be processed by a preset time-dependent formula to obtain a first time-dependent result, then the third information quality at the next moment is collected, and then step S301 is returned to update the ban probability, calculate the similarity threshold of the third information quality, and judge that the first time-dependent result is taken as the time-dependent result of the third information quality in the case that the third information quality is greater than the similarity threshold. The third information quality and the first time-dependent result are brought into formula (4) to calculate the time-dependent result, and if it is less than or equal to the similarity threshold, it is always looped until it is greater than the similarity threshold, and the time-dependent result is obtained by formula (4).

[0062] Further, the similarity threshold can also be set according to actual conditions, for example, the similarity threshold can be set to 0.8.

[0063] Scenario: When the crawler collects a certain information website (such as “XXX service platform”), the anti-crawler mechanism detects according to the access frequency and IP address. The interaction between the crawler and the anti-crawler is modeled as a non-stationary dynamic game.

[0064] Example: At time t=1 (October 1, 2023 10:00), the crawler uses IP address “192.168.1.10” to access the website at a frequency of 1 per second, successfully collects 10 pieces of bidding announcement information, and does not trigger the ban.

[0065] At time t=2 (October 1, 2023 10:05), the crawler increases the frequency to 2 per second, collects 8 pieces of information, but triggers IP ban.

[0066] Data: t=1: The amount of collected information Q1=10; t=2: The amount of collected information Q2=8.

[0067] Utility calculation: Set parameters: collection benefit weight α=1, ban cost weight β=5, historical utility weight γ=0.5, discount factor δ=0.9. Through formula (4) utility function: t=1: U1=1×10−5×0=10; t=2: U2=1×8−5×1+0.5×0.9×10=8−5+4.5=7.5.

[0068] Result: The utility function quantifies the benefits and costs of the crawler, indicating that high-frequency collection increases the amount of information, but the risk of ban significantly reduces the overall utility, providing a basis for subsequent strategy optimization.

[0069] In some embodiments of the present application, as Figure 4As shown, step S202 includes: S401, according to the historical behavior sequence and the first signal information quality, setting the state space.

[0070] Wherein, the state space refers to the historical behavior data set of the crawler within the preset time, which can be constructed by using the action sequence and the corresponding reward value in the time window, for representing the interactive state of the crawler and the anti-crawler system.

[0071] Specifically, compared with the limitation of the traditional Q-learning which relies on the table form and cannot handle complex state space, the AA-DQN (i.e. deep Q network with attention mechanism) realizes the improvement through the following steps: (1) Define the state space , which consists of two parts: The sequence of historical behavior : record the past actions and rewards of the crawler.

[0072] The current moment of the first signal information quality : including the current IP address, adjustment frequency, etc.

[0073] S402, according to the current task query amount in the first signal information quality and the current task query amount of each moment in the historical behavior sequence within the preset time, as well as the preset state feature vector, determining the feature weight of each state feature.

[0074] Wherein, the feature weight refers to the influence parameter of each state feature on the current decision, which can be dynamically allocated by sliding window statistics of the time sequence change trend of the current task query amount, combined with the dimension correlation of the preset state feature vector.

[0075] (2) Calculate the weight of state feature: The feature weight allocated by the attention mechanism for each state feature is calculated as shown in formula (5): (5) In the formula, , is the current task query amount, is the calculation query vector and the state feature vector function (common dot product: is the state feature vector, is the attention score), is the feature weight of each state feature , and is the sum obtained by processing the current task query amount of each moment in the historical behavior sequence and the state feature vector.

[0076] S403, all feature weights and state spaces within the preset time are weighted and calculated to obtain a weighted state.

[0077] Wherein, the weighted calculation refers to linear combination of the feature weights and the state space at different time points, and specifically, matrix multiplication or vector dot product can be used to realize fusion of multi-dimensional data.

[0078] (3) The weighted state is calculated according to the weight, and the calculation is as shown in formula (6): (6) In the formula, t = i , is the state space, is the weighted state at time . This step realizes dynamic focusing on key state features.

[0079] Specifically, within the preset time range, the historical action data (such as request frequency, page jump path) of the crawler and the corresponding reward value (such as the reward value of not being banned) are integrated into the state space. The fluctuation characteristics of the current task query volume in the time dimension (such as the hourly query volume peak) are analyzed in association with the preset state feature vector (such as the page element complexity, the response time threshold). The feature weight is determined by calculating the covariance or Pearson correlation coefficient between each feature dimension. Finally, the feature weight matrix of all time points within the preset time is weighted and summed with the state space vector to form a weighted state reflecting the dynamic change of the environment.

[0080] Through the above technical solution, the present application effectively solves the problem of lack of pertinence in action selection in the prior art, and can dynamically adjust the decision weight of each state feature according to the real-time collected task query volume data, avoiding the use of high-risk action strategy during the active period of the anti-crawler mechanism. The scheme realizes accurate calculation of the weighted state, so that the crawler can preferentially select behavior characteristics that are weakly related to the current anti-crawler strategy, significantly reducing resource waste and the risk of being banned due to improper allocation of feature weights.

[0081] Application of AA-DQN in the embodiment of the application: Scenario: At time t=3 (October 1, 2025, 10:10), the crawler selects actions according to the current state using the attention-enhanced deep Q network (AA-DQN) to optimize the collection strategy.

[0082] Example: Current state S3={H3, P3}: Historical behavior H3: {(t=1, frequency=1 / s, U1=10), (t=2, frequency=2 / s, U2=7.5)}; Current parameter P3: {IP = 192.168.1.11, frequency = 1 / s}; Attention mechanism: Task query amount: q = 5 (target to collect 5 pieces of information); State feature vector: k i = [3, 4, 5] (representing historical utility, current frequency, and IP state respectively); Attention score: e i = q x k i = [15, 20, 25]; Weight: w i = softmax([15, 20, 25]) ≈ [0.006, 0.047, 0.947]; Weighted state: S3 = 0.006 x S3,1 + 0.047 x S3,2 + 0.947 x S3,3; Q value estimation: Q(S3, a1) = 0.8 (switch IP to "192.168.1.12"); Q(S3, a2) = 0.6 (increase frequency to 2 / s); Selected action: select a1 (switch IP); Result: the attention mechanism highlights the importance of the IP state, and the AA-DQN selects to switch the IP, avoiding the risk of being banned, and collects 6 pieces of information (Q3 = 6).

[0083] In some embodiments of the present application, path planning is performed according to the time-dependent result and the weighted state to obtain a crawler adjustment strategy, including: Setting an action set.

[0084] The action set refers to a candidate list of preset executable actions of the crawler, which can be implemented by using a discrete action set containing adjusting request frequency, modifying request header parameters, switching proxy IP, and simulating mouse movement trajectory, to provide a selectable action space for path planning. For example, the action set : : switch IP; : increase request frequency; : decrease request frequency; : wait for a period of time; : continue collecting.

[0085] According to the weighted state, the time-dependent result, and the action set, path planning is performed to determine the predicted action value.

[0086] wherein the predicted action value refers to quantitatively evaluating the expected return of each candidate action at a future time step by the deep Q network, which can be realized by using a Q-learning algorithm combined with a time difference error to calculate an action value function, and is used to filter out actions with long-term return advantages, for example, the predicted action value , .

[0087] The crawler adjustment strategy is determined according to the predicted action value and a preset strategy.

[0088] wherein the preset strategy refers to a predefined decision rule, which can be realized by using an ε-greedy strategy, and is used to balance between exploring new actions and using known high-value actions.

[0089] The ε-greedy strategy is shown in formula (7): (7) wherein ϵ: exploration rate, decays over time (such as ),: decay period T When the predicted action value is less than , the crawler adjustment strategy in the action set is determined by , and then the crawler can be adjusted by the crawler adjustment strategy, for example, if , the browsing content is collected again after increasing the request frequency to obtain the second information quality.

[0090] Specifically, the path planning process jointly analyzes the weighted state and the time-dependent result, combines the candidate actions in the action set, and calculates the value score of each action in the current game environment by using a deep reinforcement learning model. For example, when the weighted state reflects that the current information quality is in a low-risk area, actions with high predicted action values may include increasing the collection frequency or reducing the camouflage parameters; when the time-dependent result indicates that the anti-crawler mechanism is in an active update period, actions with high predicted action values may involve increasing the request randomization or extending the operation interval. The predicted action values are filtered by the preset strategy, and finally the crawler adjustment strategy that takes into account both the immediate return and the long-term game advantage is generated.

[0091] By the technical solution, the application can dynamically optimize the crawler behavior strategy according to the real-time game state, and effectively reduce the risk of being banned due to improper action selection. For example, when detecting that the website anti-crawler mechanism is strengthened, the action of increasing the request interval or switching to a high-anonymity agent is automatically selected, which reduces resource consumption while ensuring the success rate of information quality collection. This targeted strategy adjustment enables the crawler system to adapt to different intensity and types of anti-crawler mechanisms, significantly improving information collection efficiency in complex adversarial environments.

[0092] Application of path planning in specific embodiments of the application: Scenario: At time t=4 (October 1, 2023, 10:15), the crawler uses the epsilon-greedy strategy to select actions, and updates the strategy through Q-learning.

[0093] Example: Exploration rate ϵ=0.1; Predicted action value =0.05<1-0.1, select random action a4 (wait 5 seconds) After execution: Reward value R4=-0.2 (no information collection); New state S5: {IP=192.168.1.12, frequency=1 / s}.

[0094] In some embodiments of the application, step S104 comprises: Updating the ban probability based on the second information quality to obtain a target ban probability.

[0095] The target ban probability refers to the probability value dynamically adjusted based on the second information quality for the number of bans within a preset time, which can be implemented using a sliding window statistical method or an exponential weighted average method, and is used to reflect the latest ban tendency of the anti-crawler mechanism.

[0096] Calculating the second information quality and the target ban probability according to a preset reward function to obtain a reward value; Determining whether the reward value is greater than a preset threshold; If yes, confirming that the crawler adjustment strategy is effective; If not, confirming that the crawler adjustment strategy is ineffective.

[0097] Specifically, after the execution of the crawler adjustment strategy, the second information quality is used to recalculate the blocking probability formula (2), which is used as the target blocking probability input into the preset reward function formula (3). The function jointly calculates the second information quality and the target blocking probability, for example, the product operation of the unblocked probability and the information quality, to generate a reward value reflecting the comprehensive effect of the strategy. When the reward value exceeds the preset threshold, it indicates that the adjusted strategy effectively avoids the blocking risk while ensuring the information collection quality, and the strategy is confirmed to be effective at this time; if the threshold is not reached, the strategy re-planning process is triggered. The entire process forms a closed-loop feedback through dynamically updated probability parameters and real-time collected information quality parameters, ensuring the real-time and accuracy of the strategy evaluation.

[0098] Through the above technical solution, the application can accurately evaluate the actual effect of the crawler adjustment strategy in a dynamic countermeasure environment, and avoid information collection interruption or data quality degradation caused by invalid strategies. The method realizes real-time verification of the effectiveness of the strategy through a closed-loop feedback mechanism, significantly reduces the risk of triggering the anti-crawler mechanism while ensuring the efficiency of information collection.

[0099] In some embodiments of the application, after confirming that the crawler adjustment strategy is invalid, the method further comprises: According to the preset time-dependent formula and the deep Q network, the second information quality is path planned to obtain a new crawler adjustment strategy; After adjusting the crawler according to the new crawler adjustment strategy, it is determined whether the new crawler adjustment strategy is effective; If yes, the anti-crawler mechanism is confirmed to be completed.

[0100] Specifically, when it is detected that the current crawler adjustment strategy is invalid, the system will reacquire the updated second information quality as input. Through the preset time-dependent formula, the evolution trend of the anti-crawler strategy is analyzed, for example, the change pattern of the CAPTCHA triggering frequency is identified. At the same time, the deep Q network extracts features from the second information quality, for example, analyzes the dynamic loading rules of page elements. Based on the collaborative calculation of the two, a new crawler adjustment strategy containing request interval adjustment and IP rotation rhythm optimization is generated. After the system executes the new strategy, the strategy effectiveness is verified by monitoring the response status code, data acquisition success rate and other indicators of the target website, for example, when three consecutive requests successfully acquire complete information data, the strategy is determined to be effective.

[0101] Through the above technical solution, the application effectively solves the interruption problem caused by the dynamic adjustment of the anti-crawler strategy, significantly reduces the IP blocking risk while ensuring the continuity of information quality collection. Through the closed-loop feedback mechanism, the strategy is continuously optimized, for example, when the website upgrades the CAPTCHA system, the system can adaptively adjust the CAPTCHA recognition strategy within two strategy iterations, which improves the strategy response speed compared with the fixed rule maintenance period of the traditional scheme.

[0102] In order to better implement the intelligent anti-crawler mechanism bypass method in the embodiments of the present application, on the basis of the intelligent anti-crawler mechanism bypass method, the embodiments of the present application also provide an intelligent anti-crawler mechanism bypass device, as shown in Figure 5 The intelligent anti-crawler mechanism bypass device 500 includes: A model establishing module 501 is configured to construct a historical behavior sequence based on the actions and rewards of the crawler at a preset time, and establish a deep Q network of an attention mechanism. A quality calculating module 502 is configured to, when receiving a browsing instruction, acquire first signal information quality at the current time according to the browsing instruction. A strategy determining module 503 is configured to perform path planning on the first signal information quality and the historical behavior sequence according to a preset time-dependent formula and the deep Q network, and obtain a crawler adjustment strategy. A strategy judging module 504 is configured to, after adjusting according to the crawler adjustment strategy, acquire second signal information quality, and judge whether the crawler adjustment strategy is effective according to the second signal information quality, and if so, confirm that the anti-crawler mechanism is completed.

[0103] The intelligent anti-crawler mechanism bypass device 500 provided by the above embodiments can implement the technical solutions described in the intelligent anti-crawler mechanism bypass method embodiments described above, and the principles of the specific implementation of each module or unit can be referred to the corresponding content in the intelligent anti-crawler mechanism bypass method embodiments described above, which will not be repeated here.

[0104] The intelligent anti-crawler mechanism bypass method and device provided by the present application are described in detail above, and the principles and implementation modes of the present application are described by applying specific examples. The above description of the embodiments is only used to help understand the method and its core idea of the present application. Meanwhile, for those skilled in the art, according to the idea of the present application, the specific implementation mode and application range will be changed, and the above description should not be understood as a limitation of the present application.

Claims

1. A method for bypassing intelligent anti-crawler mechanisms, characterized in that, include: Based on the actions and rewards of the crawler at a preset time, a historical behavior sequence is constructed, and a deep Q-network with an attention mechanism is established. When a browsing instruction is received, the quality of the first identifier information at the current moment is obtained according to the browsing instruction; Based on the preset time dependency formula and the deep Q-network, path planning is performed on the quality of the first tag information and the historical behavior sequence to obtain the crawler adjustment strategy; After adjusting according to the crawler adjustment strategy, the quality of the second tag information is collected, and the effectiveness of the crawler adjustment strategy is determined based on the quality of the second tag information. If it is effective, the anti-crawler mechanism is confirmed to be complete.

2. The method for bypassing the intelligent anti-crawler mechanism according to claim 1, characterized in that, The step of obtaining the quality of the first identifier information at the current moment according to the browsing instruction includes: The browsing content at the current moment is obtained according to the browsing instructions, and the target indicator template is set; The quality of the first bidding information is obtained based on the browsing content and the target bidding template.

3. The method for bypassing the intelligent anti-crawler mechanism according to claim 2, characterized in that, The step of performing path planning based on the quality of the first tag information and the historical behavior sequence according to the preset time dependency formula and the deep Q network to obtain the crawler adjustment strategy includes: The quality of the first tag information is processed according to the preset time dependency formula to obtain the time dependency result; The weighted state is obtained by weighting the quality of the first tag information and the historical behavior sequence according to the deep Q network. Based on the time dependency results and the weighted state, path planning is performed to obtain the crawler adjustment strategy.

4. The method for bypassing the intelligent anti-crawler mechanism according to claim 3, characterized in that, The step of processing the quality of the first tag information according to the preset time dependency formula to obtain the time dependency result includes: Obtain the number of times the crawler's actions were blocked and not blocked within a preset time period, and determine the blocking probability based on the number of times; A similarity threshold is obtained by calculating the preset driving preference coefficient, the blocking probability, and the quality of the first tag information based on the preset reward function; Determine whether the quality of the first tag information is greater than the similarity threshold; If not, the quality of the first tag information is processed according to the preset time dependency formula to obtain the first time dependency result; the quality of the third tag information at the next moment is obtained, and the first time dependency result and the quality of the third tag information are processed according to the preset time dependency formula and the similarity threshold is determined. If so, the quality of the first sign information is processed according to the preset time dependency formula to obtain the time dependency result.

5. The method for bypassing the intelligent anti-crawler mechanism according to claim 4, characterized in that, The step of calculating weights for the quality of the first tag information and the historical behavior sequence based on the deep Q-network to obtain a weighted state includes: Based on the historical behavior sequence and the quality of the first flag information, a state space is set; Based on the current task query volume in the first bidding information quality and the current task query volume at each moment in the historical behavior sequence within the preset time period, as well as the preset state feature vector, the feature weight of each state feature is determined. The weighted state is obtained by weighting all feature weights and the state space within the preset time period.

6. The method for bypassing the intelligent anti-crawler mechanism according to claim 3, characterized in that, The step of performing path planning based on the time dependency results and the weighted state to obtain the crawler adjustment strategy includes: Set the action set; Path planning is performed based on the weighted state, the time dependency result, and the action set to determine the predicted action value; The crawler adjustment strategy is determined based on the predicted action value and the preset strategy.

7. The method for bypassing the intelligent anti-crawler mechanism according to claim 4, characterized in that, The step of determining the effectiveness of the crawler adjustment strategy based on the quality of the second tag information includes: The blocking probability is updated based on the quality of the second tag information to obtain the target blocking probability; The reward value is obtained by calculating the quality of the second flag information and the target blocking probability based on the preset reward function; Determine whether the reward value is greater than a preset threshold; If so, then the crawler adjustment strategy is confirmed to be effective; If not, then the crawler adjustment strategy is confirmed to be invalid.

8. The method for bypassing the intelligent anti-crawler mechanism according to claim 7, characterized in that, After confirming that the crawler adjustment strategy is ineffective, the process also includes: Based on the preset time dependency formula and the deep Q-network, a new crawler adjustment strategy is obtained by performing path planning on the quality of the second tag information. After adjusting the crawler according to the new crawler adjustment strategy, determine whether the new crawler adjustment strategy is effective. If so, then the anti-scraping mechanism is confirmed to be in place.

9. The method for bypassing the intelligent anti-crawler mechanism according to claim 3, characterized in that, The preset time-dependent formula is calculated as follows: In the formula, For a moment The quality of the first tender information collected; For a moment The cost of being banned or triggering defense; a negative value is used for being banned, and a positive value is used for not being banned. These are the weighting coefficients. For a moment Discount factor; For a moment Time-dependent results; For a moment The time-dependent results.

10. A device for bypassing intelligent anti-crawler mechanisms, characterized in that, include: The model building module is used to construct historical behavior sequences based on the actions and rewards of the crawler at a preset time, and to build a deep Q-network with an attention mechanism. The quality calculation module is used to obtain the quality of the first indicator information at the current moment according to the browsing instruction when a browsing instruction is received; The strategy determination module is used to perform path planning on the quality of the first tag information and the historical behavior sequence based on a preset time dependency formula and the deep Q network to obtain a crawler adjustment strategy. The strategy judgment module is used to collect the quality of the second tag information after adjusting the crawler according to the crawler adjustment strategy, and to judge whether the crawler adjustment strategy is effective based on the quality of the second tag information. If so, the anti-crawler mechanism is confirmed to be completed.