Link detection method, link detection device, equipment and medium

Through neural network model identification and simulated event processing functions, combined with access testing, it solves the problem that traditional methods cannot detect dynamic links, achieves efficient identification and repair of implicit links, and improves the reliability of website content and user experience.

CN118760581APending Publication Date: 2024-10-11WEICHAI POWER CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410746587.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-11
Publication Date
2024-10-11

AI Technical Summary

Technical Problem

Traditional link detection methods cannot effectively identify and detect dynamically generated implicit links, resulting in the inability to comprehensively identify and repair broken links in websites.

Method used

Use the trained neural network model to identify the event processing functions in the interactive code of the web page to be detected, obtain the event triggering sequence table, and simulate the triggering event processing functions to obtain dynamically generated links, combined with access testing to ensure link validity.

Benefits of technology

It achieves accurate identification and detection of dynamically generated links, expands the scope and depth of link detection, improves the reliability and user experience of website content, and ensures the timely updating and accuracy of website content.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118760581A_ABST
    Figure CN118760581A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a link detection method, a link detection device, equipment and a medium, and the method comprises the steps: according to an interactive code of a to-be-detected webpage, adopting a trained neural network model, recognizing and obtaining an event processing function corresponding to the interactive code, and obtaining an event triggering sequence table; based on the event triggering sequence table, performing simulation triggering on the event processing functions in sequence, and obtaining a source code after each event processing function is triggered; obtaining a to-be-detected link according to the source code triggered by the event processing function and a preset link extraction rule; wherein the link to be detected comprises an explicit link and / or an implicit link; and performing an access test on the to-be-detected link to obtain a test result, and completing link detection. The event processing function is identified and acquired by adopting the trained neural network model, so that the accuracy of identifying the event processing function is improved; by simulating event triggering, the dynamically generated link can be obtained, and the link detection range is expanded.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of computer technology, and in particular to a link detection method, a link detection device, equipment and a medium. Background Art

[0002] Links are a fundamental part of web pages. They not only enable users to jump from one page to another, but are also an important way to obtain information and access resources. Effective links ensure that users can navigate and access website content smoothly, improving user satisfaction and engagement. The effectiveness of links not only affects user experience, but also the effectiveness of search engine optimization. Search engines use complex algorithms to analyze the quality and relevance of websites, and one of the key factors is the health of links. Effective links can enhance search engine trust in websites, thereby improving the ranking of websites in search results. In order to maintain the effectiveness of links, it is necessary to continuously monitor and repair broken links. Automated link detection tools can quickly identify and repair broken links, saving a lot of manual inspection time and labor. This not only improves the efficiency of maintenance work, but also ensures the timely update and accuracy of website content.

[0003] In web development and maintenance, traditional link detection methods usually rely on web crawler technology, which traverses all pages of a specified website and detects the status of each link by sending simple HTTP requests. This method can effectively identify "dead links" that return error status codes (such as 404 errors), thereby identifying invalid links. In addition to basic web crawler technology, link detection can also be performed through various tools and services, such as link detection plug-ins integrated in content management systems (CMS) or services provided by third parties. These tools usually provide regular link checking and reporting functions, and allow website administrators to configure detection frequency and notification settings, thereby enhancing the automation and user experience of link detection.

[0004] However, these traditional tools are usually unable to identify links that are generated only after user interaction (i.e., implicit links). Traditional web crawlers, which mainly rely on static page analysis, cannot effectively identify these dynamically generated links. For example, links that appear only after a user clicks a button or triggers certain events cannot be detected. Based on this, a link detection method is urgently needed to solve the technical problem of incomplete link detection in the prior art. Summary of the invention

[0005] The present invention provides a link detection method, a link detection device, equipment and a medium, which are used to solve the current technical problem of incomplete link detection.

[0006] A first aspect of an embodiment of the present invention provides a link detection method, comprising:

[0007] According to the interactive code of the web page to be detected, using the trained neural network model, identifying and obtaining the event processing function corresponding to the interactive code, and obtaining the event triggering sequence table according to the event processing function;

[0008] Based on the event triggering sequence table, the event processing functions are simulated and triggered in sequence, and the source code of each event processing function after being triggered is obtained;

[0009] According to the source code after the event processing function is triggered, a link to be detected that matches a preset link extraction rule is obtained; wherein the link to be detected includes an explicit link and / or an implicit link;

[0010] An access test is performed on the link to be tested to obtain a test result of each link to be tested, and the link test of the web page to be tested is completed.

[0011] Optionally, in the above method, the step of using a trained neural network model to identify and obtain an event processing function corresponding to the interactivity code of the web page to be detected includes:

[0012] According to the interactive code of the web page to be detected, the code segmentation technology based on syntax analysis is adopted to obtain the code segment containing the event listener;

[0013] The code segment is analyzed according to the trained neural network model to obtain the event processing function and triggering condition corresponding to the interactive code.

[0014] Optionally, in the above method, obtaining the link to be detected that matches the preset link extraction rule according to the source code after the event processing function is triggered includes:

[0015] According to the source code after the event processing function is triggered, a preset query language is used to extract the tag element containing the hyperlink address attribute to obtain the display link; wherein the query language includes XPath language or CSS selector;

[0016] and / or

[0017] According to the source code after the event processing function is triggered, a character string matching the network address format in the regular expression is obtained through a preset regular expression to obtain an implicit link.

[0018] Optionally, in the method as described above, performing an access test on the link to be tested to obtain a test result of each link to be tested includes:

[0019] Using a network request tool, sending an access request to each link to be detected, and obtaining and recording a response status of each link to be detected; wherein the response status includes at least one of a response time and a response status code;

[0020] According to the response status, a test result of each link to be detected is determined; wherein the test result includes that the link to be detected is in a valid state or that the link to be detected is in an invalid state.

[0021] Optionally, in the method described above, the event processing functions are simulated and triggered in sequence based on the event triggering sequence table, and the source code of each event processing function after being triggered is obtained, including:

[0022] According to the event triggering sequence table, the triggering sequence of each event processing function is determined, and the preset script code is executed by using an automated testing framework to simulate the triggering of the event processing functions in sequence;

[0023] After determining that the event processing function is triggered, the source code after each event processing function is triggered is obtained and recorded.

[0024] Optionally, in the method as described above, obtaining the event triggering sequence table according to the event processing function includes:

[0025] According to the event processing functions, through code analysis, the dependency relationship between the event processing functions is identified and obtained; wherein the dependency relationship includes the calling order and triggering conditions of the event processing functions;

[0026] According to the dependency relationship between the event processing functions and the event processing functions, a topological sorting algorithm is used to obtain the event triggering sequence table.

[0027] Optionally, the method as described above further includes:

[0028] Based on the global wide area network system, a web crawler tool is used to traverse all the web pages to be detected to obtain the source code of the web pages to be detected;

[0029] Parse the source code of the web page to be detected to obtain the interactive code of the web page to be detected; wherein the interactive code includes JavaScript code containing event listeners.

[0030] A second aspect of an embodiment of the present invention provides a link detection device, including:

[0031] An event identification module is used to identify and obtain an event processing function corresponding to the interactive code of the web page to be detected using a trained neural network model, and to obtain an event triggering sequence table according to the event processing function;

[0032] An event triggering module, used to simulate triggering the event processing functions in sequence based on the event triggering sequence table, and obtain the source code of each event processing function after being triggered;

[0033] A link extraction module, used to obtain a link to be detected that matches a preset link extraction rule according to the source code after the event processing function is triggered; wherein the link to be detected includes an explicit link and / or an implicit link;

[0034] The access detection module is used to perform access test on the link to be detected to obtain the test result of each link to be tested and complete the link detection of the web page to be detected.

[0035] Optionally, the device as described above further comprises:

[0036] The code extraction module is specifically used to traverse all the web pages to be detected based on the global wide area network system and use a web crawler tool to obtain the source code of the web pages to be detected; parse the source code of the web pages to be detected to obtain the JavaScript code of the web pages to be detected; wherein the JavaScript code includes an event listener.

[0037] A third aspect of an embodiment of the present invention provides an electronic device, including: a memory and a processor;

[0038] The memory stores computer-executable instructions;

[0039] The processor executes the computer-executable instructions stored in the memory to implement the link detection method described in any one of the first aspects.

[0040] A fourth aspect of an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the link detection method described in any one of the first aspects.

[0041] A fifth aspect of an embodiment of the present invention provides a computer program product, including a computer program, which, when executed by a processor, implements the link detection method described in any one of the first aspects.

[0042] The link detection method, link detection device, equipment and medium provided by the embodiment of the present invention achieve the technical effect of efficiently and accurately identifying and sorting the interactive elements of the web page by using a trained neural network model to identify the event processing function in the interactive code of the web page to be detected, and further obtain the event trigger sequence table. It is ensured that the test and verification activities can simulate the interactive behavior of real users, and the authenticity and coverage of the event processing function test are improved. Subsequently, based on the event trigger sequence table, these functions are simulated and triggered and the source code after the trigger is captured, and the dynamically generated content can be accurately analyzed and identified, including those implicit links that may only appear after a specific interaction. This method effectively solves the limitation that traditional link detection technology cannot reach dynamic elements and expands the scope and depth of link detection. Furthermore, by performing access tests on the identified explicit and implicit links, the validity of each link can be analyzed to ensure that all links are accessible. Not only the reliability of web page content is improved, but also the fluency of user access is enhanced, thereby directly improving user experience and satisfaction. This comprehensive and in-depth link detection provides solid data support for website maintenance and optimization, enabling website administrators to promptly discover and solve potential link problems and keep website content updated and accurate. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0044] Figure 1 A flowchart of a link detection method provided in an embodiment of the present application;

[0045] Figure 2 A schematic flow chart of a method for identifying and obtaining an event processing function corresponding to an interactivity code provided in an embodiment of the present application;

[0046] Figure 3 A schematic flow chart of a method for obtaining a link to be detected that matches a preset link extraction rule provided in an embodiment of the present application;

[0047] Figure 4 A schematic flow chart of a method for performing a test and obtaining a test result for each link to be tested provided in an embodiment of the present application;

[0048] Figure 5 A schematic diagram of a method flow for obtaining source code after each event processing function is triggered provided in an embodiment of the present application;

[0049] Figure 6 A schematic diagram of a method flow for obtaining an event trigger sequence table provided in an embodiment of the present application;

[0050] Figure 7A schematic flow chart of a method for obtaining the interactivity code of a web page to be detected provided in an embodiment of the present application;

[0051] Figure 8 A schematic diagram of the structure of a link detection device provided in an embodiment of the present application;

[0052] Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.

[0053] The above drawings have shown clear embodiments of the present invention, which will be described in more detail below. These drawings and text descriptions are not intended to limit the scope of the present invention in any way, but to illustrate the concept of the present invention for those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0054] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Instead, they are merely examples of devices and methods consistent with some aspects of the present invention as detailed in the appended claims.

[0055] The technical solution of the present invention is described in detail with specific embodiments below. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present invention will be described below in conjunction with the accompanying drawings.

[0056] In order to clearly understand the technical solution of the present application, the solution of the prior art is first introduced in detail. In the prior art, link detection mainly relies on web crawler technology. The basic working principle of these technologies is to automatically browse web pages, analyze Hypertext Markup Language (HTML) documents, and check the validity of all hyperlinks. Among them, HTML is a standard markup language for creating web pages, which defines the content, structure and basic layout on the web page through tags and attributes. These crawlers usually send HTTP GET requests to the target address of the link, and then judge whether the link is valid according to the Hypertext Transfer Protocol (HTTP) response status code (such as 200, 404, etc.). If the response status code shows that the page does not exist (such as 404 error), the link is marked as a "dead link". Although web crawlers are relatively effective in processing static web page content, they can quickly identify a large number of invalid links, but modern network applications widely use local refresh technology, which can update the local content of the web page without refreshing the entire web page. For example, AJAX (Asynchronous JavaScript and XML) and Single Page Application (SPA) technology. Specifically, AJAX technology is a technology that can update part of a web page without reloading the entire web page. Using AJAX technology, asynchronous data exchange and updates can be performed on web pages, which means that data can be exchanged with the server without completely reloading the page, and a part of the web page can be updated based on the server's response. Single-page application is a network application or website architecture that aims to provide a smoother user experience by dynamically rewriting the current page, rather than the traditional reloading of the entire new page from the server. Common single-page application frameworks include React, Vue.js, etc. It can be seen that these technologies enable web page content to be dynamically loaded and updated without reloading the entire page. The content of such a page, including links, is often generated after the user interacts with the web page. For example, a user clicking a button may trigger the loading of a new content block, which may contain new links. Since these links are dynamically generated after the initial page load, it is difficult for traditional web crawlers to capture and verify these dynamically generated links without simulating the corresponding user interaction.

[0057] It can be seen that the methods in the prior art often ignore the links triggered by user interaction. With the development of modern network technology, more and more web pages have adopted complex interactive designs, which requires that link detection technology must be able to adapt to this dynamic and complexity. To this end, the embodiment of the present application shows how to capture and verify such links, realize more comprehensive processing of dynamically generated links, and improve the efficiency and accuracy of link detection. The scheme combines machine learning technology to more comprehensively detect and verify all types of links in web pages, including implicit links dynamically generated by JavaScript (a programming language for adding interactive functions in web browsers). First, the interactive code of the web page is analyzed by a neural network model, the event processing function and the triggering order of these functions are identified, and an event triggering sequence table is established. The implementation of this step ensures that the subsequent simulated triggering events can be executed according to the logic of actual user interaction, thereby capturing dynamically generated content and links. Next, the triggering of the event is simulated according to the triggering sequence table, and the source code after the event processing is captured to extract all links therein (including explicit links and implicit links). Then these links are accessed and tested to verify the status of each link, thereby determining whether the link is valid. This approach allows for comprehensive detection regardless of whether the link exists when the page is loaded or is generated later by user action.

[0058] The technical solution of the present application has a wide range of application scenarios in modern network environments, especially in applications that require high interactivity and dynamic content management. For example, on e-commerce websites, product pages and transaction processes often rely on events triggered by user interactions, such as adding items to shopping carts, dynamic updates of payment interfaces, etc. The present application can effectively identify and verify the dynamically generated links on these pages, ensuring the links of all interactive links, thereby improving the user shopping experience and the smoothness of transactions. On educational platforms, course content often needs to be dynamically displayed according to students' choices, such as selecting different course modules or tests. The present technical solution ensures seamless access and access to learning content by detecting and testing these dynamically generated links, thereby enhancing the interactivity and accessibility of educational content. For social media, user-generated content on social media platforms is highly interactive, such as sharing links, pictures or videos. The present application can detect in real time whether the links embedded in these contents are valid, improve the quality of content sharing, and reduce user frustration caused by link errors. And many websites manage content publishing through content management systems, and the pages generated by these systems may contain a large number of internal links. The present application can detect the validity of these links, help content administrators maintain the health of the website, and ensure that all published content can be correctly linked.

[0059] The embodiments of the present invention are described below in conjunction with the accompanying drawings.

[0060] Figure 1 A flow chart of a link detection method provided in an embodiment of the present application is shown as follows: Figure 1 As shown, the following steps are included:

[0061] S11, according to the interactive code of the web page to be detected, using the trained neural network model, identifying and obtaining the event processing function corresponding to the interactive code, and obtaining the event triggering sequence table according to the event processing function.

[0062] In this embodiment, the trained neural network model is used to identify and process the interactive code on the web page. Among them, the interactive code mainly includes but is not limited to JavaScript or similar scripts, which can respond to user operations or web page events. The application of the neural network model here is multifaceted. First, the neural network model is trained to identify and parse various event processing functions in the web page code, which are code blocks used to process user events (such as clicks, scrolling, typing, etc.) in programming. The training of the neural network model is based on a large number of annotated data sets, which include various typical and complex web page codes, so that the model can accurately identify the characteristics and patterns of event processing functions in practical applications. The neural network model can understand complex programming patterns and event-driven structures, thereby extracting functions and their characteristics directly related to user interaction, such as bound event types and triggering conditions. Once these event processing functions are identified, the next step is to obtain an event trigger sequence table based on these functions. The event trigger sequence table describes which events will be triggered in what order during the web page interaction process. By determining the dependencies and execution order between functions, it is ensured that the corresponding events can be triggered according to the correct logic when simulating user interaction. Exemplarily, dependencies are not only based on direct links of function calls, but also consider conditional logic and user interaction paths, which helps to handle dynamic and highly interactive applications. Using this technology, the processing function of each event can be triggered at the appropriate time, thereby ensuring the comprehensiveness and accuracy of the test. This processing method based on the neural network model improves the accuracy of identifying event processing functions; by generating an event trigger sequence table, it provides an information basis for automated testing and link validity detection, so that link detection can more accurately simulate the behavior of real users and can more comprehensively analyze the interactivity and functionality of web pages.

[0063] S12, based on the event triggering sequence table, simulate triggering the event processing functions in sequence, and obtain the source code of each event processing function after being triggered.

[0064] In this embodiment, based on the event trigger sequence table, each event processing function is activated in sequence according to the sequence. This simulated trigger not only verifies the reaction of the function itself, but also ensures that the interactive logic of the entire web page runs normally as designed. The trigger is executed by programming scripts or corresponding test software, and these scripts or software are configured to simulate various user operations, such as clicking, inputting, scrolling, etc., to trigger the corresponding event processing function. Whenever an event processing function is triggered, the source code after the function is triggered is captured and recorded. This includes not only the direct output after the function call, but also the state changes of the page elements that may be affected by it, such as the loading of dynamic content, the change of visual effects, or the generation of new links. Many links may not appear at the initial page load, but are dynamically generated after a specific user interaction. For example, an e-commerce website may load additional product links only after the user clicks the "show more products" button. By simulating such events and obtaining the updated source code, it can be ensured that these dynamically generated links are detected. This method expands the scope of link detection, so that the test is no longer limited to static analysis. By simulating the actual browsing and interaction behavior of users, the functionality of the web page can be analyzed more comprehensively to ensure that all possible user paths and links are verified. In short, by simulating the triggering events and capturing the source code after event processing, those dynamically generated links are effectively exposed. This not only improves the coverage and accuracy of link detection technology, but also provides technical support for the maintenance and optimization of the website, ensuring that the website can remain efficient and stable in a complex and changing network environment.

[0065] S13, obtaining a link to be detected that matches a preset link extraction rule according to the source code after the event processing function is triggered; wherein the link to be detected includes an explicit link and / or an implicit link.

[0066] In this embodiment, after simulating user interaction to trigger the event processing function and capturing the source code after the function is triggered, the next step is to extract the links to be detected from these new source codes. According to the preset link extraction rules, various types of link configurations are matched and identified. The preset link extraction rules include a series of instructions based on pattern matching, which can identify and extract all links defined in the web page code. They mainly include explicit links and implicit links. Explicit links are usually more intuitive and directly embedded in the HTML structure, such as " " tag's "href" attribute. It should be noted that in HTML, the "href" attribute is used to specify the uniform resource locator of the link target. This attribute is most commonly used in (anchor) element, which is a tag used to create a hyperlink, allowing users to click a link to jump to another page or website. The href attribute is also used in several other tags, such as <link> and <base>

[0067] Etc. The extraction of such links can be directly achieved by parsing the Document Object Model (DOM) structure to ensure that all statically defined resource links and navigation links can be accurately captured. Among them, DOM is a cross-platform and language-independent interface that represents HTML or XML documents as a tree structure, in which each node is a part of the document, such as the document itself, elements, attributes, and text content. For implicit links, they may not appear directly in HTML tags, but are dynamically generated and inserted into the page by JavaScript after specific user operations such as clicking a button or submitting a form. In this case, the key to link extraction is to be able to execute and parse JavaScript code to capture those links that are only generated at runtime. Each extracted link will be verified and formatted to ensure that they are formatted correctly and meet standard specifications. In addition, for those links that may present multiple forms due to dynamic generation, corresponding algorithms can be set in the extraction rules to parse and standardize these links for subsequent processing and testing. This method expands the ability of link detection and ensures that whether the link exists statically when the page is loaded or is dynamically generated later, it can be fully covered and detected. It also ensures that all relevant web page elements are taken into account, which provides the necessary data basis for subsequent link validity testing and enhances the integrity and accuracy of the link detection process.

[0068] S14, performing an access test on the link to be tested to obtain a test result of each link to be tested, and completing the link test of the web page to be tested.

[0069] In this embodiment, after link extraction is completed, the link to be detected is access tested. Ensure that all links are correct not only at the code level, but also work properly in actual operation. The access test process is performed by using a network request tool, which is configured to simulate the user's network access behavior and send HTTP requests to each link. The test of each link is not only to verify its accessibility (i.e., whether the page exists), but also includes an analysis of the quality and speed of the link response. Record the response status of the link, which includes indicators such as HTTP status code and response time. For example, status code 200 indicates a successful request, 404 indicates that the page is not found, and 503 may indicate a server error. The response time reflects the length of time from sending a request to receiving a response. Further, this test analyzes links whose response behavior does not meet conventional expectations. For example, some links may lead to a redirect page, or trigger a download action instead of navigating to another page. These situations need to be identified and properly handled in the access test to ensure that the links provided to the end user are safe and expected. Through the access test, it is ensured that each link can correctly perform its original function and show good performance and stability in the actual operation of the user. The accuracy of links is directly related to the user experience and the overall reliability of the website. After completing these tests, the test results generated will provide the website administrator with a detailed link status report, enabling them to promptly correct or optimize those poorly performing links, thereby maintaining the good operation of the website. This testing method not only improves the efficiency of link detection, but also greatly reduces user access barriers and dissatisfaction caused by link problems, and enhances the overall user satisfaction of the website.

[0070] The embodiment of the present application achieves the technical effect of efficiently and accurately identifying and sorting the interactive elements of the web page by using a trained neural network model to identify the event processing function in the interactive code of the web page to be detected, and further obtains the event trigger sequence table. It ensures that the test and verification activities can simulate the interactive behavior of real users, and improves the authenticity and coverage of the event processing function test. Subsequently, based on the event trigger sequence table, the triggering of these functions is simulated and the source code after the triggering is captured, and the dynamically generated content can be accurately analyzed and identified, including those implicit links that may only appear after a specific interaction. This method effectively solves the limitation that traditional link detection technology cannot reach dynamic elements and expands the scope and depth of link detection. Further, by performing access tests on the identified explicit and implicit links, the validity of each link can be analyzed to ensure that all key links are accessible. Not only the reliability of web page content is improved, but also the fluency of user access is enhanced, thereby directly improving user experience and satisfaction. This comprehensive and in-depth link detection provides solid data support for website maintenance and optimization, enabling website administrators to promptly discover and solve potential link problems and keep website content updated and accurate.

[0071] In one embodiment, Figure 2 The present invention provides a method flow chart for identifying and obtaining an event processing function corresponding to an interactivity code. It is a specific description of an implementation method for using a trained neural network model in the above step S11 to identify and obtain an event processing function corresponding to an interactivity code. Based on the above embodiment, Figure 2 As shown, including:

[0072] S21, according to the interactive code of the web page to be detected, using the code segmentation technology based on syntax analysis to obtain the code segment containing the event listener;

[0073] S22, analyzing the code segment according to the trained neural network model to obtain the event processing function and its triggering condition corresponding to the interactive code.

[0074] In the present embodiment, the key part of the web page source code, i.e. the code segment containing the event listener, is located and extracted based on the code segmentation technology of grammar analysis. Grammar analysis is a common method in compilation technology, which is used to parse and understand the structure of the code. It is used here to identify the script parts that define the user interaction behavior, such as events such as click response, mouse movement or data input. For example, by analyzing the grammatical structure of JavaScript or other scripting languages, the event listener can be accurately identified and the corresponding code block can be extracted. These code blocks usually contain the event listening function bound to the HTML element. Once the code segment containing the event listener is extracted, the next step is to adopt a trained neural network model to further analyze these code segments.

[0075] The neural network model has learned how to identify different types of event handling functions and their triggering conditions through a large number of examples. The training of the model may involve extensive data collected from a variety of web applications, including various complex user interaction scenarios and programming habits. Through this deep learning method, the model can not only recognize common event handling patterns, but also adapt to new or non-standard codes. The benefit of applying this neural network model is that it can provide accurate analysis results. For example, the neural network model can distinguish between simple click event listeners and those complex handling functions involving conditional triggering or multi-step interactions. In addition, it can also identify the triggering conditions of events, such as specific mouse positions, typed characters, or behaviors triggered when the page reaches a certain state. Through such steps, the efficiency of testing and verification of dynamic web interactive functions can be improved. It not only speeds up debugging and error correction during the development process, but also provides technical support for maintaining high availability and excellent user experience of applications. In addition, this code and event analysis method also helps to identify potential design problems in the early development stage, thereby optimizing the overall quality and performance of the product.

[0076] In a specific embodiment, a Transformer model based on an attention mechanism is used to analyze code segments to obtain event processing functions and triggering conditions corresponding to the interactive code.

[0077] In this embodiment, a Transformer model based on an attention mechanism is used to analyze the code. The Transformer model is a model based on deep learning, which is widely used in the field of natural language processing. Its core feature is to use a self-attention mechanism to process sequence data. In Web development, this model can be trained to recognize and understand patterns and structures in JavaScript code, especially those involving event processing. In a specific embodiment, all JavaScript code segments can be first extracted from the source code collected by a web crawler. These code segments are then input into a pre-trained Transformer model. The model is trained to identify event listeners and associated event handling functions defined in the code, as well as the triggering conditions of these functions. The advantage of the Transformer model in handling such tasks is that it can capture long-distance dependencies. For example, an event handling function may depend on multiple auxiliary functions and variables defined previously. Traditional models may find it difficult to accurately capture this dependency, while the Transformer model can effectively associate these code segments through its attention mechanism. In addition, the Transformer model can also be trained to identify conditional statements in the code, which may affect the logic of event triggering. For example, an event handling function may only be triggered under certain conditions, such as when the user is logged in or there are items in the shopping cart. Using the Transformer model to analyze and identify event handling functions and their triggering conditions not only improves the accuracy of code analysis, but also speeds up development and testing efficiency.

[0078] In one embodiment, Figure 3 The following is a flow chart of a method for obtaining a link to be detected that matches a preset link extraction rule provided in an embodiment of the present application. It is a specific description of an implementation method of the above step S13. Figure 3 As shown, including:

[0079] S31, according to the source code after the event processing function is triggered, a preset query language is used to extract the tag element containing the hyperlink address attribute to obtain the display link; wherein the query language includes XPath language or CSS selector.

[0080] In this embodiment, in the present invention, by using a preset query language to analyze the source code after the event processing function is triggered, and extracting the tag elements containing the hyperlink address attribute, all display links, that is, those links explicitly defined in the HTML document, can be identified and extracted. The preset query language mainly includes XPath language and CSS selector. Among them, XPath language is a language used to find information in XML documents. It allows users to locate nodes, attributes or values ​​in XML documents by defining specific path expressions. XPath uses path expressions to select nodes or node sets in XML documents. These expressions can navigate in the XML structure, including selecting a single node, a node group, testing a certain node, node attributes, etc. The CSS selector (Cascading Style Sheets Selector) defines the object of the style rule, which can be specified according to the type, class, attribute, etc. of the element. For example, a class selector can select all HTML elements with a specific class, and an attribute selector can select elements with specific attributes. That is, XPath and CSS selectors allow developers to write rules to directly locate HTML tags containing links, such as " ”、" <link> ”、" <area> ", etc. These rules can extract the complete Uniform Resource Locator (URL; an address used to translate and locate resources on the Internet) based on the attributes of the tag, such as "href" or "src". These query languages ​​support complex query logic, such as attribute existence checks, filtering by category, and even more complex structural queries. The application of these technologies improves the accuracy and efficiency of link extraction. By accurately locating elements with hyperlink address attributes, it can not only ensure the efficient extraction of required links from the source code, but also avoid data errors or processing delays caused by misidentification of other non-link elements. In addition, this method has a high degree of automation, which reduces the need for manual inspection, thereby improving the overall efficiency of website maintenance.

[0081] For example, in the scenario of using XPath language to extract display links, suppose there are multiple product lists in the source code of a web page, and there is a link next to each product name that allows users to click to view product details. These links are usually embedded in " " tag's "href" attribute. Through XPath, you can construct an expression " / / a[@href]" to select all " " tag. Another common scenario is to use CSS selectors to extract display links. CSS selectors provide a stylized way to locate HTML elements. For example, if an e-magazine website creates an archive page, each article title in it is a link. These links may be marked with specific CSS classes, such as ".article-title>a". Using CSS selectors, it is possible to accurately capture all " "element.

[0082] S32, according to the source code after the event processing function is triggered, a character string matching the network address format in the regular expression is obtained through a preset regular expression to obtain an implicit link.

[0083] In the present embodiment, a preset regular expression is used to identify and match a string in a network address format, so as to extract an implicit link from the source code after the event processing function is triggered. Implicit links are not directly embedded in HTML tags like explicit links, but may be dynamically generated when the script is running, so it is necessary to conduct an in-depth analysis of the source code to identify these dynamically constructed URLs. Among them, a regular expression is a text processing tool for searching, matching and operating strings that conform to a specific pattern. In the present embodiment, a regular expression is identified as a URL pattern. A typical URL pattern may include starting with "http: / / " or "https: / / ", followed by one or more characters, which include letters, numbers, and certain symbols. This can match most common URL structures.

[0084] For example, in a complex single-page application, many of the content and links are dynamically generated in response to user actions. After the user interacts with the web page (such as clicking a button, selecting an option, etc.), JavaScript may build new links based on business logic and load new content through AJAX requests. In this case, using regular expressions to analyze the source code after the script is executed can effectively capture these dynamically generated implicit links. In this way, all possible links are ensured to be identified, including those that do not appear directly in the HTML source code at the time of the initial page load. It helps to prevent page errors or resource problems that cannot be found due to link errors. In short, using a preset regular expression to obtain a string that matches the network address format and extract implicit links from it not only improves the accuracy and comprehensiveness of implicit link detection, but also greatly improves the efficiency and quality of website maintenance. This enables website administrators to manage and optimize website link structures more effectively.

[0085] In one embodiment, Figure 4 The following is a flow chart of a method for performing a test and obtaining a test result of each link to be tested provided in an embodiment of the present application. It is a specific description of an implementation method of the above step S14. Figure 4 As shown, including:

[0086] S41, using a network request tool to send an access request to each link to be detected, and obtaining and recording a response status of each link to be detected; wherein the response status includes at least one of a response time and a response status code;

[0087] S42, determining a test result of each link to be detected according to the response status; wherein the test result includes that the link to be detected is in a valid state or that the link to be detected is in an invalid state.

[0088] In this embodiment, the main function of the network request tool is to simulate the behavior of users accessing web links. These tools send HTTP or HTTPS requests to each link to be detected, and then record the returned responses. The response data includes at least the response time and the response status code, which are indicators for analyzing the health status of the link. Among them, the response time reflects the total time required from sending a request to receiving a response. A longer response time may indicate a slow server response or a network delay problem, which may affect the user experience. The response status code provides direct evidence of whether the request is successful or not. Common status codes include 200 (successful request), 404 (resource not found), 500 (internal server error), etc. The status code not only helps to identify which links are valid, but also indicates the specific error type, such as whether the link is invalid because the resource does not exist or the server problem. Based on the response status obtained by the network request tool, each link is classified as valid or invalid. This classification is based on the following criteria: If the status code returned by the link is 200, it means that the link is valid and the content is accessible. In addition, if the response time is within an acceptable range, it also indicates that the performance of the link is not a problem. If the link returns a status code such as 404 or 500, indicating that the link is invalid, or the response time is too long, exceeding the preset threshold, this may also be considered a functional problem with the link. In general, this method can not only quickly and accurately analyze the status of a large number of links, but also reduce the need for manpower through automated testing and improve maintenance efficiency. In addition, regular access testing like this can help website administrators continuously monitor the health of website links, detect and solve problems in a timely manner, and thus maintain the stability of the website.

[0089] In one embodiment, Figure 5 The following is a flow chart of a method for obtaining the source code after each event processing function is triggered, provided in an embodiment of the present application. It is a specific description of an implementation method for simulating the triggering of the event processing function in the above step S12 and obtaining the source code after each event processing function is triggered. Figure 5 As shown, including:

[0090] S51, determining the triggering order of each event processing function according to the event triggering order table, and using the automated testing framework to execute the preset script code to simulate the triggering event processing functions in sequence;

[0091] S52, after determining that the event processing function is triggered, obtaining and recording the source code after each event processing function is triggered.

[0092] In this embodiment, the application of the event trigger sequence table is to ensure that each event processing function can be correctly triggered according to the logical order of the web page design. Using the automated test framework to simulate the triggering of these events not only improves the efficiency and accuracy of the test, but also makes the test process repeatable and reliable. Among them, automated test frameworks such as Selenium or Puppeteer allow developers to write scripts to automatically perform user interface interactions and simulate the behavior of real users. Among them, Selenium is an automated testing tool designed for Web applications. It supports multiple browsers and can be used with multiple programming languages, such as Java, Python, Ruby and JavaScript. Selenium is mainly used to automate Web browser operations, such as clicking, filling out forms, and crawling web page content. Puppeteer is usually used in scenarios such as Web crawlers, automated testing, and generating page screenshots or PDF files. In this embodiment, according to the event trigger sequence table, the test framework will execute the preset script code in sequence, and each script corresponds to the triggering of one or more event processing functions. These scripts specify how to trigger each event, such as simulating click operations, typing text, or scrolling pages. By executing these scripts, the automated test framework can trigger each event processing function in a set order. This simulation not only tests the response of the functions themselves, but also tests their performance in actual operation, including any dynamic content updates or visual changes triggered by events. Then, after each event handling function is triggered, the automated testing framework is also responsible for obtaining and recording the source code after the trigger. This includes any HTML dynamically generated by JavaScript or changed DOM elements. In addition, the analysis after obtaining the source code can also be used to detect security issues, such as performance issues, such as memory leaks. This analysis can be used to maintain network services, which ensures that the application is not only functionally correct, but also reliable in performance and security. By using an automated testing framework to simulate event triggering and record the results, the degree of automation and accuracy of testing can be improved, and the need for manual testing can be reduced, thereby saving time and cost. The test results and code analysis provided by this approach provide a solid foundation for continuous quality assurance and problem solving.

[0093] Furthermore, in a specific embodiment, Figure 6 The following is a flow chart of a method for obtaining an event trigger sequence table provided in an embodiment of the present application. This is a specific implementation method for obtaining the event trigger sequence table in the above step S11 or step S51. Based on the above embodiment, Figure 6 As shown, including:

[0094] S61, identifying and acquiring dependencies between event processing functions through code analysis according to the event processing functions; wherein the dependencies include a calling sequence and a triggering condition of the event processing functions;

[0095] S62, according to the dependency relationship between event processing functions, a topological sorting algorithm is used to obtain an event triggering sequence table.

[0096] In this embodiment, the source code is first analyzed by a code analysis tool, especially JavaScript or similar scripts containing interactive functions. This analysis not only identifies each event processing function, but also deeply explores the dependencies between these functions. Dependencies may include, but are not limited to, direct calls between functions, data dependencies (the output of one function is the input of another function), and conditional dependencies (the triggering of one function depends on the specific state or output of another function). For example, a shopping cart function may involve a function for adding items to a shopping cart and another function for updating the display of the shopping cart. If the display update function depends on the successful execution of the add function, this dependency must be correctly understood and implemented to ensure the data accuracy and logical consistency of the user interface. After the dependency is identified, the next step is to determine a reasonable event triggering order to ensure that the interactive logic of the application is executed as designed. The topological sorting algorithm used here. Topological sorting is an algorithm for sorting directed graphs, which can linearly sort the vertices in the graph so that for any directed edge from vertex U to vertex V, U will appear before V in the sorting. In the event processing function, each event processing function can be regarded as a vertex, and the dependency can be regarded as a directed edge. Topological sorting can clarify which functions must be triggered first and which functions must be triggered later, thereby effectively implementing complex user interaction sequences. All event processing functions are triggered according to the correct dependencies, avoiding potential logical errors. Secondly, this approach increases the maintainability and scalability of the code, because the clear definition of dependencies and triggering order makes future modifications and extensions easier and safer. In short, by combining code analysis and topological sorting algorithms, the efficiency and accuracy of event processing are optimized.

[0097] Exemplarily, by analyzing the JavaScript code of the web page, all event handling functions and their associated triggers (such as button clicks, mouse movements, etc.) are identified. This analysis uses static code analysis tools that can parse JavaScript code and identify function declarations and event listener settings. For example, if a button click event triggers function A, and function A calls function B internally, a dependency relationship between A and B is established. The analysis of the code is not limited to direct function calls, but also includes conditional statements and logic in loop structures that may affect the order of event triggering. The connection between each function and the event it triggers is recorded to form a preliminary dependency graph. In this dependency graph, nodes represent event handling functions, and directed edges indicate that the execution of one function depends on the completion of another function.

[0098] Once the dependencies are fully mapped to the dependency graph, a topological sorting algorithm is used to determine a reasonable event handling function triggering order. Topological sorting is an algorithm for sorting a directed acyclic graph (DAG), which outputs a linear sequence of vertices. Specifically, a directed acyclic graph is a specific type of graph structure in which each edge has a direction, pointing from one vertex to another; there is no path in the graph that starts from a vertex and passes through several vertices and then returns to the starting vertex, that is, there is no closed loop in the graph. According to the linear sequence of output vertices, the call of each node (event handling function) occurs only after the node it depends on (prerequisite event handling function). When implementing topological sorting, first select a node with no incoming edges from the dependency graph (event handling function without dependencies or prerequisites), add it to the sorting result, and remove this node and all its outgoing edges from the graph (remove the influence of this function on other functions). This process is repeated until all nodes are sorted. In this way, not only the logical consistency and correctness of web page event processing are ensured, but also the maintainability and testability of dynamic web pages are improved.

[0099] Figure 7 The flowchart of the method for obtaining the interactivity code of the web page to be detected provided in the embodiment of the present application is a specific description of an implementation method of obtaining the interactivity code before the above step S11. Figure 7 As shown, including:

[0100] S71, based on the global wide area network system, using a web crawler tool to traverse all the web pages to be detected to obtain the source code of the web pages to be detected;

[0101] S72, parsing the source code of the web page to be detected to obtain the interactive code of the web page to be detected; wherein the interactive code includes JavaScript code including an event listener.

[0102] In this embodiment, the web crawler tool is software that automatically accesses web pages on the Internet and obtains their content. In this solution, these tools are configured to access specific or preset websites on the global wide area network and automatically download the HTML and related script files of each page. These crawlers can generally handle a variety of web page technologies, including dynamically generated content and data loaded through JavaScript. Web crawlers can quickly and accurately access and record web page data. It should be noted that web crawlers need to be able to comply with the rules of the robots.txt file to avoid affecting website performance. Among them, robots.txt is a text file located in the root directory of the website. It is used to indicate to the web crawler which parts of the website can be crawled and which parts should not be crawled. This file is a basic way to manage the interaction between the website and the search engine robot. After obtaining the source code of the web page, the next step is to parse the code to extract the JavaScript script. The parsing work involves checking the " <script>”标签以及可能的外部JavaScript文件链接。提取出的JavaScript代码随后会被进一步分析,以识别和记录所有定义的事件监听器。事件监听器通常与特定的用户行为(如点击、滚动、键入等)关联。通过这种方法,能够全面地获取和分析待检测网页的交互特性,从而确保后续步骤(如模拟用户交互和验证链接)的准确性和有效性。

[0103] 在链接检测和事件模拟的过程中,准确的错误处理和异常管理策略是确保测试连续性和准确性的关键。通过制定和实施策略,能够有效应对各种预见和非预见的问题,从而维持测试流程的稳定性和可靠性。

[0104] 示例性的,在链接检测和事件模拟中可能遇到的错误和异常可以大致分为以下几类:网络错误,这包括超时、断开连接等网络问题,这些问题可能导致无法成功发送或接收HTTP请求;HTTP错误,如404(未找到)、500(服务器内部错误)等HTTP状态码,这些错误表明链接可能存在问题;脚本错误,在模拟事件时,JavaScript或其他客户端脚本可能执行失败,如因为语法错误、运行时错误等;资源加载失败,外部资源(如CSS文件、图片、第三方服务)加载失败,可能影响页面的完整性和事件的正确触发。

[0105] 对于每种错误和异常,采取以下具体的处理策略:网络错误和HTTP错误处理,采用重试机制,在遇到网络错误或某些HTTP错误(如503服务不可用)时,自动进行重试,重试次数和间隔时间可配置。所有错误都被记录在日志文件中,包括错误类型、时间、影响的URL和可能的错误描述。脚本错误处理,使用try / catch块在脚本执行时捕获异常,防止一个错误影响整个页面的测试。其中,try / catch块是一种结构,用于处理可能出现错误的代码。代码片段放在try块中,如果在执行这些代码时发生错误,程序将不会停止,而是跳转到catch块。在catch块中,可以定义处理错误的逻辑,如记录错误信息、恢复操作等。在捕获到错误时,记录详细的堆栈信息和脚本状态,帮助开发人员快速定位问题源头。资源加载失败的处理,对所有外部资源进行状态检测,确认是否成功加载;对关键资源设置备用选项和加载超时,确保页面功能的完整性。

[0106] 图8为本申请实施例提供的链接检测装置的结构示意图,如图8所示,本实施例中,链接检测装置8可以位于电子设备中。该链接检测装置8包括:

[0107] 事件识别模块81,用于根据待检测网页的交互性代码,采用已训练的神经网络模型,识别并获取与交互性代码对应的事件处理函数,以及根据事件处理函数,获取事件触发顺序表;

[0108] 事件触发模块82,用于基于事件触发顺序表,依次对事件处理函数进行模拟触发,并获取每个事件处理函数触发后的源代码;

[0109] 链接提取模块83,用于根据事件处理函数触发后的源代码,获取与预设链接提取规则匹配的待检测链接;其中,待检测链接包括显式链接和 / 或隐式链接;

[0110] 访问检测模块84,用于对待检测链接进行访问测试,以获取每个待测试链接的测试结果,完成待检测网页的链接检测。

[0111] 可选的,链接检测装置8还包括代码提取模块;

[0112] 代码提取模块,具体用于基于全球广域网系统,采用网络爬虫工具,遍历所有的待检测网页,以获取待检测网页的源代码;解析待检测网页的源代码,以获取待检测网页的交互性代码;其中,交互性代码包括包含事件监听器的JavaScript代码。

[0113] 本实施例提供的链接检测装置可以执行上述方法实施例的技术方案,其实现原理和技术效果与上述方法实施例类似,在此不再一一赘述。

[0114] 根据本发明的实施例,本发明还提供了一种电子设备、一种计算机可读存储介质和一种计算机程序产品。

[0115] 如图9所示,图9为本申请实施例提供的电子设备的结构示意图。电子设备旨在各种可以执行链接检测方法使用的各种电子设备,诸如,微型计算机、单片机、和其它适合的计算机。本文所示的部件、它们的连接和关系、以及它们的功能仅仅作为示例,并且不意在限制本文中描述的和 / 或者要求的本发明的实现。

[0116] 如图9所示,该电子设备9包括:至少一个处理器91和存储器92。该电子设备9还包括通信部件93。其中,处理器91、存储器92以及通信部件93通过总线94连接。

[0117] 在具体实现过程中,至少一个处理器91执行存储器92存储的计算机执行指令,使得至少一个处理器91执行如上电子设备侧所执行的链接检测方法。

[0118] 处理器91的具体实现过程可参见上述方法实施例,其实现原理和技术效果类似,本实施例此处不再赘述。

[0119] 存储器92即为本发明所提供的非瞬时计算机可读存储介质。本发明的非瞬时计算机可读存储介质存储计算机指令,该计算机指令用于使计算机执行本发明所提供的链接检测方法。

[0120] 存储器92作为一种非瞬时计算机可读存储介质,可用于存储非瞬时软件程序、非瞬时计算机可执行程序以及模块,如本发明实施例中的链接检测方法对应的程序指令 / 模块。处理器91通过运行存储在存储器92中的非瞬时软件程序、指令以及模块,从而执行各种功能应用以及数据处理,即实现上述方法实施例中的链接检测方法。

[0121] 本申请还提供一种计算机可读存储介质,计算机可读存储介质中存储有计算机执行指令,当处理器执行计算机执行指令时,实现如上链接检测方法。

[0122] 上述的计算机可读存储介质,上述可读存储介质可以是由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(Static Random-AccessMemory简称:SRAM),电可擦除可编程只读存储器(Electrically Erasable ProgrammableRead-Only Memory,简称:EEPROM),可擦除可编程只读存储器(Erasable ProgrammableRead-Only Memory,简称:EPROM),可编程只读存储器(Programmable Read-Only Memory,简称:PROM),只读存储器(Read-Only Memory,简称:ROM),磁存储器,快闪存储器,磁盘或光盘。可读存储介质可以是通用或专用计算机能够存取的任何可用介质。

[0123] 同时,本实施例还提供一种计算机产品,当该计算机产品中的指令由处理器执行时,使得能够执行上述实施例的链接检测方法。

[0124] 本领域技术人员在考虑说明书及实践这里公开的发明后,将容易想到本发明实施例的其它实施方案。本发明旨在涵盖本发明实施例的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本发明实施例的一般性原理并包括本发明实施例未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本发明实施例的真正范围和精神由权利要求书指出。

[0125] 应当理解的是,本发明实施例并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本发明实施例的范围仅由所附的权利要求书来限制。< / script>

Claims

1. A link detection method, It is characterized in that include: According to the interactive code of the web page to be detected, using the trained neural network model, identifying and obtaining the event processing function corresponding to the interactive code, and obtaining the event triggering sequence table according to the event processing function; Based on the event triggering sequence table, the event processing functions are simulated and triggered in sequence, and the source code of each event processing function after being triggered is obtained; According to the source code after the event processing function is triggered, a link to be detected that matches a preset link extraction rule is obtained; wherein the link to be detected includes an explicit link and / or an implicit link; An access test is performed on the link to be tested to obtain a test result of each link to be tested, and the link test of the web page to be tested is completed.

2. The method according to claim 1, It is characterized in that The method of using a trained neural network model to identify and obtain an event processing function corresponding to the interactivity code of the web page to be detected includes: According to the interactive code of the web page to be detected, the code segmentation technology based on syntax analysis is adopted to obtain the code segment containing the event listener; The code segment is analyzed according to the trained neural network model to obtain the event processing function and triggering condition corresponding to the interactive code.

3. The method according to claim 1, It is characterized in that The step of obtaining the link to be detected that matches the preset link extraction rule according to the source code after the event processing function is triggered includes: According to the source code after the event processing function is triggered, a preset query language is used to extract the tag element containing the hyperlink address attribute to obtain the display link; wherein the query language includes XPath language or CSS selector; and / or According to the source code after the event processing function is triggered, a character string matching the network address format in the regular expression is obtained through a preset regular expression to obtain an implicit link.

4. The method according to claim 1, It is characterized in that The step of performing an access test on the link to be tested to obtain a test result of each link to be tested includes: Using a network request tool, sending an access request to each link to be detected, and obtaining and recording a response status of each link to be detected; wherein the response status includes at least one of a response time and a response status code; According to the response status, a test result of each link to be detected is determined; wherein the test result includes that the link to be detected is in a valid state or that the link to be detected is in an invalid state.

5. The method according to claim 1, It is characterized in that The method of simulating triggering the event processing functions in sequence based on the event triggering sequence table and obtaining the source code of each event processing function after being triggered includes: According to the event triggering sequence table, the triggering sequence of each event processing function is determined, and the preset script code is executed by using an automated testing framework to simulate the triggering of the event processing functions in sequence; After determining that the event processing function is triggered, the source code after each event processing function is triggered is obtained and recorded.

6. The method according to claim 1 or 5, It is characterized in that The step of obtaining an event triggering sequence table according to the event processing function includes: According to the event processing functions, through code analysis, the dependency relationship between the event processing functions is identified and obtained; wherein the dependency relationship includes the calling order and triggering conditions of the event processing functions; According to the dependency relationship between the event processing functions and the event processing functions, a topological sorting algorithm is used to obtain the event triggering sequence table.

7. The method according to any one of claims 1 to 5, It is characterized in that The method further comprises: Based on the global wide area network system, a web crawler tool is used to traverse all the web pages to be detected to obtain the source code of the web pages to be detected; Parse the source code of the web page to be detected to obtain the interactive code of the web page to be detected; wherein the interactive code includes JavaScript code containing event listeners.

8. A link detection device, It is characterized in that include: An event identification module is used to identify and obtain an event processing function corresponding to the interactive code of the web page to be detected using a trained neural network model, and to obtain an event triggering sequence table according to the event processing function; An event triggering module, used to simulate triggering the event processing functions in sequence based on the event triggering sequence table, and obtain the source code of each event processing function after being triggered; A link extraction module, used to obtain a link to be detected that matches a preset link extraction rule according to the source code after the event processing function is triggered; wherein the link to be detected includes an explicit link and / or an implicit link; The access detection module is used to perform access test on the link to be detected to obtain the test result of each link to be tested and complete the link detection of the web page to be detected.

9. An electronic device, It is characterized in that include: Memory and processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the link detection method according to any one of claims 1 to 7.

10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the link detection method according to any one of claims 1 to 7.

Citation Information

Cited By

  • Multi-modal translation method in cross-border e-commerce scene

    CN119415787A