Data collection method, system, electronic device and medium

Managing data collection by obtaining configuration parameters and judging the number of identifiers solves the problem of repeated collection and loss in data collection, achieves comprehensiveness and timeliness of data, improves collection efficiency, and saves resources.

CN118332217BActive Publication Date: 2024-10-15SHANGHAI MIDU INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410749687.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-12
Publication Date
2024-10-15
Estimated Expiration
2044-06-12

AI Technical Summary

Technical Problem

Existing data collection technology has problems with data loss or omission and repeated collection, resulting in inaccurate and incomplete collection results, affecting data analysis and application effects, and increasing server burden.

Method used

By obtaining the configuration parameters, including the basic path link, the maximum successful identifier, the number of generated identifiers and the expiration time, the number of new identifiers is determined. If it is greater than zero, the queue to be fetched is obtained. If it is less than or equal to zero, the queue is suspended and repeated collection is performed to avoid Duplicate collection and data loss ensure the comprehensiveness and timeliness of data collection.

Benefits of technology

It improves the efficiency of data collection, avoids repeated collection and data loss, ensures the comprehensiveness and timeliness of data, and reduces manual intervention and resource consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118332217B_ABST
    Figure CN118332217B_ABST
Patent Text Reader

Abstract

The present application provides a data collection method, system, electronic device and medium, the data collection method comprising: obtaining configuration parameters, the configuration parameters including basic path link, maximum successful identifier, number of generated identifiers, maximum identifier and expiration time; obtaining the number of newly added identifiers according to the configuration parameters; judging whether the number of newly added identifiers is greater than zero, if so, obtaining the newly added identifier interval, and obtaining the queue to be captured according to the newly added identifier interval and the basic path link, if not, repeatedly obtaining the number of newly added identifiers according to the configuration parameters after hibernation, and judging whether the number of newly added identifiers is greater than zero. This data collection method can improve the efficiency of data collection, avoid the problems of repeated collection and data loss, and ensure the comprehensiveness and timeliness of data collection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of data processing technology, and relates to a data collection method, and in particular to a data collection method, system, electronic equipment and medium. Background Art

[0002] With the rapid development of the Internet, data collection has become an important way for many companies and research institutions to obtain information. By collecting web article link data, we can understand users' interests, hobbies, behavioral habits and other information, and provide important references for the company's marketing strategy and product positioning. However, when collecting data, we often encounter some problems. First, the existing technology is often not comprehensive. Due to the complex and diverse content of web pages, the existing collection technology can often only obtain part of the link data, and cannot fully obtain all the relevant information on the web page. This leads to inaccuracy and incompleteness of the collection results, affecting the effect of subsequent data analysis and application. Secondly, the existing technology is prone to repeated collection. Due to the high update frequency of web link data, many web article links will be collected multiple times, resulting in data redundancy and waste. Moreover, repeated collection will increase the burden on the server and affect the efficiency and speed of collection.

[0003] In general, data collection is an important technical field that requires continuous exploration and innovation to meet the needs of users for information and the development needs of enterprises. By continuously improving and optimizing the collection technology, we can better obtain and utilize web article link data, providing strong support for the development and progress of various industries. However, existing data collection methods still have problems such as repeated collection, data loss or omission. Summary of the invention

[0004] In view of the above-mentioned shortcomings of the prior art, the purpose of the present application is to provide a data collection method, system, electronic device and medium, which are used to solve the problem that data collection in the prior art easily causes data loss or omission and repeated collection.

[0005] In a first aspect, the present application provides a data collection method, which includes: obtaining configuration parameters, the configuration parameters including a basic path link, a maximum successful identifier, a generated identifier quantity, a maximum identifier and an expiration time; obtaining the quantity of newly added identifiers according to the configuration parameters; judging whether the quantity of newly added identifiers is greater than zero, and if so, obtaining a newly added identifier interval, and obtaining a queue to be captured according to the newly added identifier interval and the basic path link; if not, repeatedly obtaining the quantity of newly added identifiers according to the configuration parameters after sleeping, and judging whether the quantity of newly added identifiers is greater than zero.

[0006] In this application, the number of newly added identifiers is obtained according to the configuration parameters, and it is determined whether the number of newly added identifiers is greater than zero. If it is greater than zero, it means that there is a new identifier interval for which data has not been collected, so as to obtain the queue to be captured. If it is less than or equal to zero, it means that there is no uncollected data, and the data collection operation is repeated after a period of dormancy. This data collection method can improve the efficiency of data collection, avoid the problems of repeated collection and data loss, and ensure the comprehensiveness and timeliness of data collection. In addition, this data collection method can also automatically generate identifiers, collect data in a distributed manner, reduce manual intervention, and save resources and labor costs.

[0007] In an implementation of the first aspect, obtaining the number of newly added identifiers according to the configuration parameters includes: obtaining the maximum successful identifier, the number of generated identifiers and the maximum identifier as the configuration parameters; performing addition and subtraction operations on the maximum successful identifier, the number of generated identifiers and the maximum identifier in the configuration parameters to obtain the number of newly added identifiers.

[0008] In an implementation of the first aspect, obtaining a queue to be crawled according to the newly added identifier interval and the basic path link includes: generating an article link according to the interval of the newly added identifier and the basic path link; and placing each of the article links into a collection queue to obtain the queue to be crawled.

[0009] In an implementation of the first aspect, obtaining a queue to be captured according to the newly added identifier interval and the basic path link includes: updating the maximum identifier according to the maximum identifier and the number of newly added identifiers to obtain an updated maximum identifier; obtaining the number of newly added identifiers according to the updated maximum identifier as the configuration parameter, and repeating data collection.

[0010] In an implementation of the first aspect, the data collection method also includes: obtaining any article link in the queue to be crawled; sending a request to obtain the web page content of the article link, and determining whether the request is successful. If the request is successful, obtaining and storing the content of the article link; if the request fails, determining whether to add the article link to the queue to be crawled.

[0011] In an implementation of the first aspect, a request is sent to obtain the web page content of the article link, and it is determined whether the request is successful. If the request is successful, the content of the article link is obtained and stored, including: determining whether the current identifier is greater than the maximum successful identifier, if so, updating the maximum successful identifier to the current identifier, parsing the web page content of the article link and storing it, if not, directly parsing the web page content of the article link and storing it.

[0012] In an implementation of the first aspect, a request is sent to obtain the web page content of the article link, and it is determined whether the request is successful. If the request fails, it is determined whether the article link is added to the queue to be crawled, including: judging whether the article link has expired according to the expiration time, if so, discarding the article link, if not, judging whether the current identifier is greater than the maximum success identifier; if the current identifier is greater than the maximum success identifier, adding the article link to the queue to be crawled, if the current identifier is less than or equal to the maximum success identifier, judging whether the article link is configured with an expiration time; if the article link is not configured with an expiration time, configuring an expiration time for the article link, and adding it to the queue to be crawled after repeating data collection.

[0013] In a second aspect, the present application provides a data acquisition system, which includes: a parameter configuration module, used to obtain configuration parameters, the configuration parameters including a basic path link, a maximum successful identifier, a number of generated identifiers, a maximum identifier and an expiration time; a parameter acquisition module, used to obtain the number of newly added identifiers according to the configuration parameters; a data acquisition module, used to determine whether the number of newly added identifiers is greater than zero, and if so, obtain a newly added identifier interval, and obtain a queue to be captured based on the newly added identifier interval and the basic path link, and if not, repeatedly obtain the number of newly added identifiers according to the configuration parameters after sleeping, and determine whether the number of newly added identifiers is greater than zero.

[0014] In a third aspect, the present application provides an electronic device, comprising: a memory for storing a computer program; and a processor for executing the computer program stored in the memory, so that the electronic device performs a data collection method as described in any one of the first aspects.

[0015] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the data collection method described in any one of the first aspects. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1A Shown is a schematic diagram of an application scenario of the data collection method described in this application.

[0017] Figure 1B Shown are structural diagrams of the client-cloud interaction scenarios in these implementations.

[0018] Figure 2 Shown is a flow chart of the data collection method described in an embodiment of the present application.

[0019] Figure 3Shown is a flow chart of the data collection method described in an embodiment of the present application.

[0020] Figure 4 Shown is a flow chart of the data collection method described in an embodiment of the present application.

[0021] Figure 5 Shown is a flow chart of the data collection method described in an embodiment of the present application.

[0022] Figure 6 Shown is a flow chart of the data collection method described in an embodiment of the present application.

[0023] Figure 7 Shown is a flow chart of the data collection method described in an embodiment of the present application.

[0024] Figure 8 Shown is a structural schematic diagram of the data acquisition system described in an embodiment of the present application.

[0025] Fig. 9 Shown is a schematic diagram of the structure of an electronic device described in an embodiment of the present application. DETAILED DESCRIPTION

[0026] The following describes the embodiments of the present application through specific examples, and those skilled in the art can easily understand other advantages and effects of the present application from the contents disclosed in this specification. The present application can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present application. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.

[0027] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present application, and thus the drawings only show components related to the present application rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed at will, and the component layout may also be more complicated.

[0028] With the popularization of the Internet and the accelerated advancement of informatization, a large amount of data is generated and stored in various forums, websites, applications and devices. These data cover various information in various fields, such as news, social media, e-commerce, finance, etc. The explosion of information has brought about the diversity and massiveness of data, and also provided a wide range of application scenarios for data collection. Data is considered to be a valuable resource that can provide important decision support and business insights for enterprises, governments and individuals. Data collection is the premise of data-driven decision-making. Only when sufficient, accurate and timely data is obtained can effective analysis and utilization be carried out. Data collection is mainly carried out in the following three ways:Account collection: There are many accounts, the collection speed is slow, the account collection is incomplete, and it is easy to miss.According to keyword collection: The keyword coverage is incomplete and there may be page turning restrictions.According to column collection: The column collection is incomplete, not sorted by time, and there may be page turning restrictions. However, there are problems such as a large number of accounts, a large number of keywords, and a large number of columns, which lead to slow polling speed and seriously affect the collection speed.

[0029] At least for the above-mentioned problem, an embodiment of the present application provides a data collection method, which includes obtaining configuration parameters, the configuration parameters including a basic path link, a maximum successful identifier, a number of generated identifiers, a maximum identifier and an expiration time; obtaining the number of newly added identifiers according to the configuration parameters; judging whether the number of newly added identifiers is greater than zero, and if so, obtaining a new identifier interval, and obtaining a queue to be captured according to the new identifier interval and the basic path link; if not, repeatedly obtaining the number of newly added identifiers according to the configuration parameters after sleeping, and judging whether the number of newly added identifiers is greater than zero.

[0030] In the embodiment of the present application, the number of newly added identifiers is obtained according to the configuration parameters, and it is determined whether the number of newly added identifiers is greater than zero. If it is greater than zero, it means that there is a newly added identifier interval for which data has not been collected, so as to obtain the queue to be captured. If it is less than or equal to zero, it means that there is no uncollected data, and the data collection operation is repeated after a period of dormancy. This data collection method can improve the efficiency of data collection, avoid the problems of repeated collection and data loss, and ensure the comprehensiveness and timeliness of data collection.

[0031] Figure 1A The data acquisition device 1 can be used to implement the data acquisition method provided in the embodiment of the present application, but the application scenario of the data acquisition method provided in the embodiment of the present application is not limited to Figure 1A The data acquisition device 1 shown. Figure 1A As shown, the data collection device 1 includes a local processor 11 and a database 12. The data collection method provided in the embodiment of the present application can be applied to the local processor 11.

[0032] in, Figure 1A The local processor 11 in the embodiment may be a local processor or a local processor cluster composed of multiple local processors or a cloud computing center, etc., which is not limited here. Figure 1A Only one local processor 11 and one database 12 are shown, but it should be understood that Figure 1A The examples are only used to understand the present solution, and the specific numbers of local processors 11 and databases 12 should be flexibly determined based on actual conditions.

[0033] In some other implementations, the data acquisition device 1 may not include the database 12, but only include a local processor 11 with a storage function. The data acquisition method provided in the embodiment of the present application can be applied to the local processor 11. The local processor 11 with a storage function may include a tablet computer, a laptop computer, a PDA, a mobile phone, a personal computer (PC), etc., which is not limited here.

[0034] In still other implementations, the data collection method described in the present application may be applied to end-cloud interaction scenarios. Figure 1B The following is a schematic diagram of the structure of the client-cloud interaction scenario in these implementations. Figure 1B As shown, the terminal-cloud interaction system 2 includes a terminal 20 and a cloud server 21. The terminal 20 and the cloud server 21 can communicate with each other, and the communication method is not limited to wired or wireless.

[0035] Among them, the terminal 20 can be mobile or fixed, for example, the terminal 20 can be a wireless terminal or a wired terminal. The wireless terminal can refer to a device with wireless transceiver function, which can be deployed indoors, outdoors and in industrial workshops. The terminal 20 can be a mobile phone, a tablet computer, a laptop computer, etc., which is not limited here. The cloud server 21 can include one or more servers, or one or more processing nodes, or one or more virtual machines running on the server. The cloud server 21 can also be called a server cluster, a management platform, a data processing center, etc., which is not limited in the embodiments of the present application.

[0036] The technical solutions in the embodiments of the present application will be described in detail below in conjunction with the drawings in the embodiments of the present application.

[0037] The following embodiments of the present application provide a data collection method, for example, Figure 1A The local processor 11 or Figure 1B It is implemented by the cloud server 21 shown. Figure 2 The flowchart of the data collection method described in the embodiment of the present application is shown as follows: Figure 2 As shown, the data collection method includes steps S11 to S13.

[0038] Step S11, obtaining configuration parameters, wherein the configuration parameters include a basic path link, a maximum successful identifier, a number of generated identifiers, a maximum identifier, and an expiration time.

[0039] Optionally, the maximum success identifier is the identifier with the largest number among all request links, for example, link and links The maximum successful identifier in is 272117. The expiration time is the data collection time configured for the article. If the expiration time is -1, it is considered that the article has not been published and needs to be crawled all the time. If the expiration time is 1 hour, then if the data collection request fails again after 1 hour, it will be discarded. This application is not limited to this. The basic path link is the link after removing the identifier, for example, the link The base path link is , that is, the basic path link is unchanged, and the identifier is constantly changing.

[0040] Step S12: acquiring the number of newly added identifiers according to the configuration parameters.

[0041] Step S13, determine whether the number of the newly added identifiers is greater than zero, if so, obtain the newly added identifier interval, and obtain the queue to be captured according to the newly added identifier interval and the basic path link, if not, then repeatedly obtain the number of the newly added identifiers according to the configuration parameters after sleeping, and determine whether the number of the newly added identifiers is greater than zero. Specifically, the newly added identifier interval is [maximum identifier + 1, maximum identifier + number of newly added identifiers].

[0042] In the embodiment of the present application, the number of newly added identifiers is obtained according to the configuration parameters, and it is determined whether the number of newly added identifiers is greater than zero. If it is greater than zero, it means that there is a newly added identifier interval for which data has not been collected, so as to obtain the queue to be captured. If it is less than or equal to zero, it means that there is no uncollected data, and the data collection operation is repeated after a period of dormancy. This data collection method can improve the efficiency of data collection, avoid the problems of repeated collection and data loss, and ensure the comprehensiveness and timeliness of data collection.

[0043] Figure 3 The flowchart of the data collection method described in the embodiment of the present application is shown as follows: Figure 3 As shown, the step S12 includes steps S121 to S122.

[0044] Step S121, obtaining the maximum successful identifier, the number of generated identifiers and the maximum identifier as the configuration parameters.

[0045] Step S122: performing addition and subtraction operations according to the maximum successful identifier in the configuration parameters, the number of generated identifiers, and the maximum identifier to obtain the number of newly added identifiers.

[0046] In some possible implementations, the calculation formula for the number of newly added identifiers is: .

[0047] in, is the number of newly added identifiers, is the maximum success identifier, To generate the number of identifiers, is the maximum identifier.

[0048] In one embodiment of the present application, obtaining the queue to be captured according to the newly added identifier interval and the basic path link includes: generating article links according to the newly added identifier interval and the basic path link, and placing each article link into a collection queue to obtain the queue to be captured. , the newly added identifier interval is [272110, 272117], then according to the interval of the newly added identifier, the identifiers in the newly added identifier interval are respectively combined with the basic path links to generate article links, and each of the article links is placed in the collection queue to obtain the queue to be captured.

[0049] Figure 4 The flowchart of the data collection method described in the embodiment of the present application is shown as follows: Figure 4 As shown, the step S13 includes steps S131 to S132.

[0050] Step S131: Update the maximum identifier according to the maximum identifier and the number of newly added identifiers to obtain an updated maximum identifier.

[0051] Step S132, using the updated maximum identifier as the configuration parameter to obtain the number of the newly added identifiers, and repeating data collection. Optionally, using the updated maximum identifier as the configuration parameter to obtain the number of the newly added identifiers and the interval of the newly added identifiers, using the interval of the newly added identifiers and the basic path link to generate an article link, and repeating data collection.

[0052] Figure 5 The flowchart of the data collection method described in the embodiment of the present application is shown as follows: Figure 5 As shown, step S13 includes steps S133 to S134.

[0053] Step S133, obtaining any article link in the queue to be crawled.

[0054] Step S134, sending a request to obtain the webpage content of the article link, determining whether the request is successful, if the request is successful, obtaining and storing the content of the article link, if the request fails, determining whether to add the article link to the queue to be crawled. The request is an HTTP request for obtaining the webpage content pointed to by the article link.

[0055] Figure 6 The flowchart of the data collection method described in the embodiment of the present application is shown as follows: Figure 6 As shown, the step S134 includes steps S1341 to S1342.

[0056] Step S1341, determining whether the current identifier is greater than the maximum successful identifier.

[0057] Step S1342: If yes, update the maximum success identifier to the current identifier, parse the web page content linked to the article and store it; if no, directly parse the web page content linked to the article and store it.

[0058] In some possible implementations, after the request to obtain the article link is successful, the current identifier is first compared with the maximum successful identifier. If the current identifier is greater than the maximum successful identifier, the maximum successful identifier is updated as the current identifier, and the webpage content of the article link is parsed and stored. If the current identifier is less than or equal to the maximum successful identifier, the webpage content of the article link is directly parsed and stored.

[0059] Figure 7 The flowchart of the data collection method described in the embodiment of the present application is shown as follows: Figure 7 As shown, the step S134 includes steps S1343 to S1346.

[0060] Step S1343, judging whether the article link has expired according to the expiration time.

[0061] Step S1344: If yes, discard the article link; if no, determine whether the current identifier is greater than the maximum successful identifier.

[0062] Step S1345: if the current identifier is greater than the maximum success identifier, the article link is added to the queue to be crawled; if the current identifier is less than or equal to the maximum success identifier, it is determined whether the article link is configured with an expiration time.

[0063] Step S1346: If the article link is not configured with an expiration time, an expiration time is configured for the article link, and the data is repeatedly collected and added to the queue to be captured.

[0064] In some possible implementations, after a request to obtain an article link fails, it is determined whether the article link has expired. If it has expired, it is determined that the article link does not need to be collected and the article link is discarded. If the article link has not expired, it is determined whether the current identifier is greater than the maximum success identifier. If the current identifier is greater than the maximum success identifier, it means that the article link has not been captured and is added to the queue to be captured. If the current identifier is less than or equal to the maximum success identifier, it is determined whether the article link is configured with an expiration time. If the expiration time is configured, it means that the article link has been processed and is waiting for the next capture. If the article link is not configured with an expiration time, a past time is configured for the article link, and the article link is added to the queue to be captured when waiting for the next capture.

[0065] In some other possible implementations, configuration parameters are obtained, and the number of newly added identifiers is obtained according to the maximum successful identifier, the number of generated identifiers, and the maximum identifier in the configuration parameters. It is determined whether the newly added identifier is greater than zero according to the number of newly added identifiers. If not, the number of newly added identifiers is repeatedly obtained according to the configuration parameters after sleep, and it is determined whether the number of newly added identifiers is greater than zero. If so, the newly added identifier interval is obtained, and article links are generated according to the newly added identifier interval and the basic path link, and each article link is placed in the collection queue to obtain the queue to be captured. Specifically, any article link in the queue to be captured is obtained, a request is sent to obtain the web page content of the article link, and it is determined whether the request is successful. If the request is successful, it is determined whether the current identifier is greater than the maximum successful identifier. If so, the maximum successful identifier is updated as the current identifier, and the web page content of the article link is parsed and stored. If not, the web page content of the article link is directly parsed and stored. If the request fails, it is determined whether the article link has expired according to the expiration time. If so, the article link is discarded. If not, it is determined whether the current identifier is greater than the maximum successful identifier. If the current identifier is greater than the maximum successful identifier, the article link is added to the queue to be captured. If the current identifier is less than or equal to the maximum successful identifier, it is determined whether the article link is configured with an expiration time. If the article link is not configured with an expiration time, an expiration time is configured for the article link, and the article link is added to the queue to be captured after repeated data collection.

[0066] It should be noted that the above are only two possible implementation methods of the embodiments of the present application, and the present application is not limited thereto.

[0067] Figure 8 The structure diagram of the data acquisition system described in the embodiment of the present application is shown as follows: Figure 8 As shown, the data acquisition system 100 includes a parameter configuration module 110 , a parameter acquisition module 120 and a data acquisition module 130 .

[0068] The parameter configuration module 110 is used to obtain configuration parameters, which include a basic path link, a maximum successful identifier, a number of generated identifiers, a maximum identifier, and an expiration time.

[0069] The parameter acquisition module 120 is used to acquire the number of newly added identifiers according to the configuration parameters.

[0070] The data acquisition module 130 is used to determine whether the number of the newly added identifiers is greater than zero. If so, the newly added identifier interval is obtained, and the queue to be captured is obtained based on the newly added identifier interval and the basic path link. If not, the number of the newly added identifiers is repeatedly obtained according to the configuration parameters after hibernation, and it is determined whether the number of the newly added identifiers is greater than zero.

[0071] It should be noted that the above modules 110 to 130 included in the data acquisition system 100 are Figure 2 Steps S11 to S13 in the data collection method shown correspond to each other and are not described in detail here.

[0072] In the embodiment of the present application, the parameter configuration module 110 is used to obtain configuration parameters, the parameter acquisition module 120 is used to obtain the number of newly added identifiers according to the configuration parameters, and the data acquisition module 130 is used to determine whether the number of newly added identifiers is greater than zero. If it is greater than zero, it means that there is a newly added identifier interval for which data has not been collected, thereby obtaining a queue to be captured. If it is less than or equal to zero, it means that there is no uncollected data, and the data collection operation is repeated after a period of dormancy. This data collection system 100 can improve the efficiency of data collection, avoid the problems of repeated collection and data loss, and ensure the comprehensiveness and timeliness of data collection.

[0073] In the several embodiments provided in the present application, it should be understood that the disclosed system, device or method can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of modules / units is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or units can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or modules or units, which can be electrical, mechanical or other forms.

[0074] The modules / units described as separate components may or may not be physically separated, and the components displayed as modules / units may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules / units may be selected according to actual needs to achieve the purpose of the embodiments of the present application. For example, the functional modules / units in the various embodiments of the present application may be integrated into one processing module, or each module / unit may exist physically separately, or two or more modules / units may be integrated into one module / unit.

[0075] Those of ordinary skill in the art should further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0076] An embodiment of the present application also provides an electronic device. Fig. 9 The structure diagram of the electronic device 900 described in the embodiment of the present application is shown. Fig. 9 As shown, in this embodiment, the electronic device 900 includes a memory 910 and a processor 920 .

[0077] The memory 910 is used to store computer programs; preferably, the memory 910 includes: ROM, RAM, disk, USB flash drive, memory card or optical disk, etc., various media that can store program codes.

[0078] Specifically, the memory 910 may include a computer system readable medium in the form of a volatile memory, such as a random access memory (RAM) and / or a cache memory. The electronic device 900 may further include other removable / non-removable, volatile / non-volatile computer system storage media. The memory 910 may include at least one program product having a set (e.g., at least one) of program modules, which are configured to perform the functions of the various embodiments of the present application.

[0079] The processor 920 is connected to the memory 910 and is used to execute the computer program stored in the memory 910 so that the electronic device 900 executes the data collection method described in any embodiment of the present application.

[0080] Optionally, the processor 920 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.

[0081] Optionally, the electronic device 900 in this embodiment may further include a display 930. The display 930 is communicatively connected to the memory 910 and the processor 920, and is used to display a graphical user interface (GUI) interaction interface related to the data collection method described in the embodiment of the present application.

[0082] The present application also provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the data collection method described in any embodiment of the present application is implemented.

[0083] The descriptions of the processes or structures corresponding to the above-mentioned figures have different emphases. For parts that are not described in detail in a certain process or structure, please refer to the relevant descriptions of other processes or structures.

[0084] The above embodiments are merely illustrative of the principles and effects of the present application and are not intended to limit the present application. Anyone familiar with the technology may modify or change the above embodiments without violating the spirit and scope of the present application. Therefore, all equivalent modifications or changes made by a person of ordinary skill in the art without departing from the spirit and technical ideas disclosed in the present application shall still be covered by the claims of the present application.

Claims

1. A data collection method, characterized in that: include: Obtain configuration parameters, including a basic path link, a maximum successful identifier, a number of generated identifiers, a maximum identifier, and an expiration time; Acquire the number of newly added identifiers according to the configuration parameters; Determine whether the number of the newly added identifiers is greater than zero. If so, obtain the newly added identifier interval, and obtain the queue to be captured according to the newly added identifier interval and the basic path link. If not, repeatedly obtain the number of the newly added identifiers according to the configuration parameters after sleeping, and determine whether the number of the newly added identifiers is greater than zero. Wherein, acquiring the queue to be captured according to the newly added identifier interval and the basic path link comprises: generating article links according to the newly added identifier interval and the basic path link; placing each of the article links into a collection queue to acquire the queue to be captured; The data collection method further comprises: obtaining any one of the article links in the queue to be captured; sending a request to obtain the webpage content of the article link, and determining whether the request is successful. If the request is successful, obtaining and storing the content of the article link; if the request fails, determining whether to add the article link to the queue to be captured; Send a request to obtain the web page content of the article link, determine whether the request is successful, and if the request fails, determine whether to add the article link to the queue to be crawled, including: determining whether the article link has expired according to the expiration time, if so, discarding the article link, if not, determining whether the current identifier is greater than the maximum success identifier; if the current identifier is greater than the maximum success identifier, adding the article link to the queue to be crawled, if the current identifier is less than or equal to the maximum success identifier, determining whether the article link is configured with an expiration time; if the article link is not configured with an expiration time, configuring an expiration time for the article link, and adding it to the queue to be crawled after repeating data collection.

2. The data collection method according to claim 1, characterized in that: Acquiring the number of newly added identifiers according to the configuration parameters includes: Obtaining a maximum successful identifier, a number of generated identifiers, and a maximum identifier as the configuration parameters; Perform addition and subtraction operations according to the maximum successful identifier in the configuration parameter, the number of generated identifiers, and the maximum identifier to obtain the number of the newly added identifiers.

3. The data collection method according to claim 1, characterized in that: Acquiring a queue to be captured according to the newly added identifier interval and the basic path link includes: Update the maximum identifier according to the maximum identifier and the number of the newly added identifiers to obtain an updated maximum identifier; The updated maximum identifier is used as the configuration parameter to obtain the number of the newly added identifiers, and data collection is repeated.

4. The data collection method according to claim 1, characterized in that: Sending a request to obtain the webpage content of the article link, determining whether the request is successful, and if the request is successful, obtaining the content of the article link and storing it includes: Determine whether the current identifier is greater than the maximum successful identifier. If so, update the maximum successful identifier to the current identifier, parse and store the web page content linked to the article. If not, directly parse and store the web page content linked to the article.

5. A data acquisition system, characterized in that: include: A parameter configuration module, used to obtain configuration parameters, wherein the configuration parameters include a basic path link, a maximum successful identifier, a number of generated identifiers, a maximum identifier, and an expiration time; A parameter acquisition module, used to acquire the number of newly added identifiers according to the configuration parameters; A data acquisition module, used to determine whether the number of the newly added identifiers is greater than zero, if so, obtain the newly added identifier interval, and obtain the queue to be captured according to the newly added identifier interval and the basic path link, if not, repeatedly obtain the number of the newly added identifiers according to the configuration parameters after sleeping, and determine whether the number of the newly added identifiers is greater than zero; The data collection module is further used to: generate article links according to the interval of the newly added identifier and the basic path link; put each article link into the collection queue to obtain the queue to be captured; The data acquisition system is also used to: obtain any article link in the queue to be crawled; send a request to obtain the web page content of the article link, determine whether the request is successful, if the request is successful, obtain and store the content of the article link, and if the request fails, determine whether to add the article link to the queue to be crawled; send a request to obtain the web page content of the article link, determine whether the request is successful, and if the request fails, determine whether to add the article link to the queue to be crawled, including: determine whether the article link has expired according to the expiration time, if so, discard the article link, if not, determine whether the current identifier is greater than the maximum success identifier; if the current identifier is greater than the maximum success identifier, add the article link to the queue to be crawled, if the current identifier is less than or equal to the maximum success identifier, determine whether the article link is configured with an expiration time; if the article link is not configured with an expiration time, configure an expiration time for the article link, and repeat data acquisition before adding it to the queue to be crawled.

6. An electronic device, characterized in that: The electronic device comprises: Memory for storing computer programs; A processor, wherein the processor is used to execute the computer program stored in the memory so that the electronic device executes the data collection method according to any one of claims 1 to 4.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the data collection method described in any one of claims 1 to 4 is implemented.