Data collection method and device
By determining the sorting parameter values of web page channels and obtaining high-value channels for data collection, the problem of low efficiency of web page channel data collection in the existing technology is solved, and more efficient data collection is achieved.
Patent Information
- Application Number
- CN202111412638.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-25
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2041-11-25
AI Technical Summary
The existing technology is inefficient when collecting web page channel data, especially when there are a large number of channels, and lacks targeted processing.
By determining the sorting parameter value based on the number of updated items of the web page channel, the first M web page channels whose sorting parameter values are greater than the threshold are obtained, and data collection is performed. M is a positive integer.
The pertinence and efficiency of data collection are improved, web channels with higher value are collected first, and the collection time is shortened.
Smart Images

Figure CN114090935B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a data acquisition method and device. Background Art
[0002] With the development of Internet technology, it is becoming more and more common to collect data from channel pages such as news and posts that are constantly updated on various websites.
[0003] At present, in the process of collecting web page channel data, a method of polling all channels in the website and collecting them one by one is adopted.
[0004] However, this method does not take the number of channels into consideration, and is not targeted when collecting data from a large number of channels on the website, resulting in low efficiency in data collection. Summary of the invention
[0005] The embodiments of the present application provide a data collection method and device to solve the problem of low efficiency in data collection for channels in the prior art.
[0006] In order to solve the above technical problems, the embodiments of the present application adopt the following technical solutions:
[0007] In a first aspect, the present application provides a data collection method, comprising:
[0008] Determining a ranking parameter value of the web channel based on the number of update items of the web channel;
[0009] Obtain the first M webpage channels whose ranking parameter values are greater than a first threshold;
[0010] Based on the obtained first M webpage channels, data collection is performed;
[0011] Wherein, M is a positive integer.
[0012] In a second aspect, the present application provides a data acquisition device, comprising:
[0013] A determination module, used to determine a ranking parameter value of a webpage channel based on the number of update items of the webpage channel;
[0014] An acquisition module, used for acquiring the first M webpage channels whose ranking parameter values are greater than a first threshold;
[0015] A data collection module, used for collecting data based on the first M webpage channels obtained;
[0016] Wherein, M is a positive integer.
[0017] In a third aspect, the present application provides a server comprising: a processor, a memory, and a program or instruction stored in the memory and running on the processor, wherein the program or instruction implements the steps of the method of the first aspect when executed by the processor.
[0018] In a fourth aspect, the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method of the first aspect are implemented.
[0019] At least one of the above technical solutions adopted in the embodiments of the present application can achieve the following beneficial effects:
[0020] In the embodiment of the present application, the ranking parameter value of the webpage channel is determined based on the number of update items of the webpage channel; the first M webpage channels whose ranking parameter value is greater than the first threshold are obtained; data collection is performed based on the obtained first M webpage channels; wherein M is a positive integer. In this way, the ranking parameter value of the webpage channel can be calculated, and data collection can be performed according to the size of the ranking parameter value, so that data collection can be performed more targeted, and the efficiency of data collection for the webpage channel can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0022] Figure 1 A flow chart of a data collection method provided in an embodiment of the present application;
[0023] Figure 2 A flow chart of a data collection method provided in an embodiment of the present application;
[0024] Figure 3 A flow chart of a data collection method provided in an embodiment of the present application;
[0025] Figure 4 A flow chart of a data collection method provided in an embodiment of the present application;
[0026] Figure 5 A structural block diagram of a data acquisition device provided in an embodiment of the present application;
[0027] Figure 6 A structural block diagram of a server provided in an embodiment of the present application. DETAILED DESCRIPTION
[0028] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0029] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0030] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.
[0031] Figure 1 is a flow chart of a data collection method provided in an embodiment of the present application. Figure 1 , the data collection method provided in the embodiment of the present application may include:
[0032] Step 110: determining a ranking parameter value of the webpage channel based on the number of update items of the webpage channel.
[0033] Among them, the web channel can be a channel in a certain website, or it can be a channel of the entire network, that is, all websites. For example, in the Sina website, Sina Health, Sina Hebei, etc. are web channels. A website can be divided into three levels of pages: the first level page is the homepage of the website; the second level page is linked to the homepage, that is, the second level page is clicked from the homepage; the third level page is linked to the second level page, that is, the third level page is clicked from the second level page. Channels can be the classification of the content of this website, and there will often be titles on the homepage, such as "Entertainment", "Music", etc. The so-called website (Website) refers to a collection of related web pages for displaying specific content on the Internet (Internet) according to certain rules, using tools such as HyperText Markup Language (HTML). Simply put, a website is a communication tool, just like a bulletin board, people can use the website to publish the information (information) they want to make public, or use the website to provide related network services. People can visit the website through a web browser to obtain the information (information) they need or enjoy network services. A web page can be a file. A web page can be stored in a computer somewhere in the world, and this computer is connected to the Internet. A web page can be identified and accessed through a URL. After entering the URL in the browser, after a complex and fast process, the web page file can be transferred to the computer, and then the browser interprets the content of the web page and finally displays it to the user.
[0034] In the embodiment of the present application, the number of update items of the webpage channel may be the number of update items on the display page corresponding to the link of the webpage channel. An update item may be an update information, such as an updated news item. There are multiple implementation methods for determining the sorting parameter value of the webpage channel based on the number of update items of the webpage channel in step 110. The following examples are used to illustrate each of them.
[0035] In one embodiment of the present application, the number of update items may include: the number of first update items updated within a unit statistical period and the number of second update items updated this time; step 110 may specifically include: using the ratio of the second number of update items to the first number of update items as the sorting parameter value of the web page channel.
[0036] In this way, the ranking parameter value of the web page channel can be determined by the number of second update items updated this time and the number of first update items updated within the unit statistical period. Since the ranking parameter value of the web page channel is determined by the ratio of the number of second update items to the number of first update items, the ranking parameter value can intuitively reflect the proportion of the number of second update items updated this time to the number of first update items updated within the unit statistical period. The larger the proportion, the higher the proportion of the number of second update items updated this time. Generally speaking, the web page channels with high proportions of this update are the web page channels targeted for data collection, and their value is relatively high. Data can be collected from these web page channels preferentially. In this way, by obtaining web page channels with relatively high values from massive web page channels through ranking parameter values, data collection for web page channels can be more targeted.
[0037] It is understandable that the unit statistical period can be selected according to the actual application situation, and the unit statistical period can be a statistical period calculated from the current moment forward (i.e., to the historical time point). The unit statistical period in the embodiment of the present application can be measured in days, hours or minutes, and the present application is not limited. The total number of update items updated within the unit statistical period can be represented by total_count, the number of update items updated this time can be represented by new_count, and the ranking parameter value of the web channel can be represented by rank, then rank = new_count / total_count. For example, the unit statistical period can be 5 days, the total number of update items updated by the channel within 5 days can be 10,000, and the number of update items updated this time can be 100, then the ranking parameter value can be 0.01 at this time; the unit statistical period can also be 7 days, the total number of update items updated by the channel within 7 days can be 15,000, and the number of update items updated this time can be 300, then the ranking parameter value can be 0.02 at this time.
[0038] In another embodiment of the present application, the number of update items may include: the number of third update items updated within a first statistical period and the number of fourth update items updated within a second statistical period, wherein the second statistical period may be smaller than the first statistical period. For example, the first statistical period may be an integer multiple of the second statistical period, such as 2 to 1000 times. The second statistical period may be measured in minutes or hours, and the first statistical period may be measured in days or hours, for example, the second statistical period may be 40 minutes, and the first statistical period may be 1 day or 7 days. Accordingly, step 110 may specifically include: using the ratio of the fourth number of update items to the third number of update items as the sorting parameter value of the web channel.
[0039] Since the ranking parameter value of the webpage channel is determined by the ratio of the number of fourth update items to the number of third update items, the ranking parameter value can intuitively reflect the proportion of the number of fourth update items updated in the second statistical period to the number of third update items updated in the first statistical period. The larger the proportion, the higher the proportion of the number of fourth update items updated this time. Generally speaking, webpage channels with a high proportion of updates in the second statistical period are the webpage channels targeted for data collection, and have a relatively higher value. Data can be collected from these webpage channels first. In this way, by obtaining webpage channels with relatively high values from massive webpage channels through ranking parameter values, data collection can be performed on webpage channels in a more targeted manner.
[0040] It can be understood that the first statistical period and the second statistical period can be selected according to the actual application situation, and both the first statistical period and the second statistical period can be statistical periods calculated from the current moment forward (i.e., to the historical time point). For example, the first statistical period can be 1 day, the second statistical period can be 40 minutes, the number of third update items updated by the channel within 1 day can be 100, and the number of fourth update items updated by the channel within 40 minutes can be 10, then the sorting parameter value can be 0.1 at this time; the first statistical period can also be 7 days, the second statistical period can be 40 minutes, the number of third update items updated by the channel within 7 days can be 1000, and the number of fourth update items updated by the channel within 40 minutes can be 10, then the sorting parameter value can be 0.01 at this time.
[0041] It is to be understood that the above are only examples of ways to determine the ranking parameter value of a web channel. In the embodiments of the present application, any way that can reflect the importance or value of a web channel can be used to determine the ranking parameter value of a web channel. For example, the number of updated items of a web channel in a specified period of time can be directly used as the ranking parameter value of the web channel, or the number of updated items of a web channel in a specified period of time multiplied by a weight coefficient can be used as the ranking parameter value of the web channel.
[0042] Step 120: Obtain the first M webpage channels whose ranking parameter values are greater than a first threshold.
[0043] Wherein, M is a positive integer; the first threshold value can be set according to actual application conditions; the first M webpage channels can be obtained in the order of the sorting parameter values from large to small and the sorting parameter values are greater than the first threshold value.
[0044] For example, if a website has 30,000 channels in total, 10,000 channels have a ranking parameter value greater than 0.005, and another 20,000 channels have a ranking parameter value less than or equal to 0.005, then the first threshold can be set to 0.005, and the value of M can be 10000. In this way, the number of channels collected can be controlled by setting the first threshold.
[0045] Step 130: performing data collection based on the first M webpage channels obtained.
[0046] In the embodiment of the present application, after the number M of webpage channels is determined, data collection is performed on the first M webpage channels, so that webpage channels with high ranking parameter values can be collected preferentially.
[0047] The collected data may be the link and title of the web channel. In practical applications, only the link and title of the web channel may be collected, without collecting all the contents of the web channel.
[0048] It is understandable that when data is collected from web channels, it can be targeted at a specific large website, and then data is collected from the channels under this website; it can also be targeted at the entire network, that is, data is collected from the channels under all websites on the Internet.
[0049] The data collection method provided in the embodiment of the present application calculates the ranking parameter value of the web page channel and collects data according to the size of the ranking parameter value, so that data collection can be performed more specifically and the efficiency of data collection for the web page channel can be improved.
[0050] In one embodiment of the present application, before determining the ranking parameter value of the web channel based on the number of updated items of the web channel in step 110, the data collection method provided by the embodiment of the present application may further include: obtaining the collection depth value and the collection number limit value of the web channel; and obtaining multiple target web channels based on the collection depth value and the collection number limit value. Accordingly, the determination of the ranking parameter value of the web channel based on the number of updated items of the web channel in step 110 may include: determining the ranking parameter value of each web channel based on the number of updated items of each web channel in the multiple target web channels. In this way, the required multiple target web channels can be determined by the collection depth value and the collection number limit value of the web channel, and the ranking parameter value can be determined only for these web channels, without determining the ranking parameter value for all web channels. These multiple target web channels may be web channels that need to be included. In this way, by determining the ranking parameter value only for the included web channels, the range of web channels that need to determine the ranking parameter value can be narrowed, thereby reducing the workload of calculation. At the same time, by setting the collection depth value and the collection number limit value of the web channel, the user's requirements for the collected web channels can be better met.
[0051] Wherein, the acquisition depth value can reflect the level of the web page. The initial value of the acquisition depth value can be 0 or 1. Taking 1 as an example, for example, the acquisition depth value of a first-level page (i.e., homepage) of a website can be 1, the acquisition depth value of a second-level page clicked from the first-level page can be 2, the acquisition depth value of a third-level page clicked from the second-level page can be 3, and so on. Taking 0 as an example, for example, the acquisition depth value of a first-level page (i.e., homepage) of a website can be 0, the acquisition depth value of a second-level page clicked from the first-level page can be 1, the acquisition depth value of a third-level page clicked from the second-level page can be 2, and so on.
[0052] In an embodiment of the present application, the acquisition depth value can be the same for each web page channel, regardless of whether the domain name is the same. For example, the acquisition depth value can be set to the same value for all web page channels, which can facilitate the same standard acquisition of web page channels under each domain name, and facilitate the subsequent management of web page channels. At the same time, the same acquisition depth value can be set for the same domain name, and different acquisition depth values can be set for different domain names. On the one hand, it can ensure that the acquisition standards of web page channels under the same domain name are the same, which is convenient for the subsequent management of the same domain name. On the other hand, by setting different acquisition depth values for different domain names, it is convenient to distinguish between web page channels under domain names that users are concerned about and web page channels under domain names that they are not concerned about, so as to better meet the user's needs for various web page channels.
[0053] The collection number limit value in the embodiment of the present application can be a threshold value for data collection for a domain name. For example, if the collection number limit value for a certain domain name (for example, Sina) is 20, then in the process of data collection, if the number of web channels collected under this domain name reaches 20, data collection under this domain name can no longer be continued. The embodiment of the present application can set the same collection number limit value for all domain names, so that the same number of web channels under each domain name can be collected, which is convenient for subsequent comparative analysis between web channels under different domain names. At the same time, different collection number limit values can also be set for different domain names. In this way, more web channels can be collected for the domain name of concern, and fewer web channels can be collected for the domain name of no concern, so as to better meet the actual needs.
[0054] In the process of acquiring multiple target webpage channels based on the collection number limit value and the collection depth value, the webpage channels of the previous level under a certain domain name can be acquired first according to the order of the depth value. After the acquisition of the webpage channels of the previous level is completed, if the collection number limit value for the domain name has not been reached, the webpage channels of the next level under this domain name can be acquired. Of course, if the collection number limit value for the domain name has been reached before the acquisition of the webpage channels of the previous level is completed, the webpage channels with the number of collection number limit value can be acquired in sequence according to the display order of the webpage channels under this domain name. For example, if the collection number limit value for a certain domain name (for example, Sina) is 50, the webpage channels are first acquired under the homepage of Sina. At this time, the number of webpage channels acquired is only 30, then the webpage channels are acquired under the second-level page clicked from the homepage of Sina. At this time, the number of webpage channels acquired in the second-level page of Sina is 20, and the acquisition of webpage channels is completed; or, under the homepage of Sina, the webpage channels can be acquired in sequence according to the display order of the webpage channels under the homepage of Sina. If the number of webpage channels acquired has reached 50, the webpage channels are not acquired on the next-level page.
[0055] The following description takes as an example that the initial value of the collection depth value is 0, the collection depth value for all webpage channels is 1, and the collection number limit value set for all domain names is 20. It should be understood that the description here is only an example and is not intended to be limiting.
[0056] For example, you can first obtain web channels on the homepage of the domain name Sina. At this time, the number of web channels obtained is only 13. Then continue to obtain web channels on the secondary page clicked from the homepage of Sina. At this time, the number of web channels that can be obtained on the secondary page of Sina is 7, and the acquisition of web channels is completed; or, before the acquisition of web channels on the homepage of Sina is completed, the number of web channels obtained has reached 20, then you can obtain 20 web channels in sequence according to the display order of web channels on the homepage of Sina, and there is no need to obtain web channels from the secondary page of Sina; or, you can first obtain 10 web channels in sequence according to the display order of web channels on the homepage of the domain name Sina, and then obtain 10 web channels in sequence according to the display order of web channels on the homepage of the domain name Tencent, and then the acquisition of web channels is completed.
[0057] After acquiring multiple target web channels, the ranking parameter value of each web channel can be determined based on the number of updated items of each web channel in the multiple target web channels, and the first M web channels whose ranking parameter value is greater than the first threshold value can be acquired; data collection is performed based on the acquired first M web channels. In the process of data collection, the first M web channels can be acquired every first preset period. After acquiring the first M web channels each time, the items on each web channel in the acquired first M web channels can be saved, and the items on the web channel acquired this time can be compared with the items on the web channel acquired next time, and the number of updated items of the web channel can be obtained by comparison. Taking a web channel in the first M web channels (hereinafter referred to as a designated web channel) as an example, after acquiring the items on the designated web channel for the first time, the items on the designated web channel acquired for the first time can be saved, and after acquiring the items on the designated web channel for the second time, the items on the designated web channel acquired for the second time can be saved. Afterwards, the items on the designated web channel acquired for the second time can be compared with the items on the designated web channel acquired for the first time, and the number of updated items of the web channel can be determined by comparison. Specifically, the items on the designated webpage channel acquired for the first time are P, and the items on the designated webpage channel acquired for the second time are Q, then the number of update items of the designated webpage channel may be Q-P.
[0058] In the embodiment of the present application, the update item of the designated webpage channel may correspond to the data to be collected. In the process of data collection, part or all of the content on the update item may be collected.
[0059] Figure 2 is a flow chart of a data collection method provided in an embodiment of the present application. Figure 2 ,exist Figure 1 On the basis of, the data collection method provided in the embodiment of the present application may include:
[0060] Step 210, determining a ranking parameter value of the webpage channel based on the number of update items of the webpage channel;
[0061] It should be understood that after step 210, both steps 120-130 and subsequent steps 220-230 may be performed. The specific steps after step 210 may be set according to the actual application situation and are not limited here. For example, it may be considered that data collection is also performed on webpage channels with relatively high historical values within the statistical period calculated from the current moment forward (i.e., to the historical time point), and then both steps 120-130 and subsequent steps 220-230 may be performed after step 210.
[0062] Step 220: Acquire the top N webpage channels whose ranking parameter value is less than or equal to the first threshold and greater than the second threshold, and whose number of update items meets a preset condition.
[0063] The first threshold may be greater than the second threshold, and N is a positive integer.
[0064] Optionally, the number of update items may include the total number of update items updated in a unit statistical period, and the preset condition may include: the total number of update items updated in the unit statistical period is greater than a preset value.
[0065] The second threshold and the preset value can be set according to actual application conditions. The first N webpage channels can be obtained according to the order of the sorting parameter value from large to small, the sorting parameter value is less than the first threshold and greater than the second threshold, and the number of update items meets the preset condition and the number of update items is obtained in a descending order.
[0066] For example, if a website has 30,000 channels in total, 10,000 channels have a ranking parameter value greater than 0.005, 10,000 channels have a ranking parameter value less than or equal to 0.005 and greater than 0.001, and another 10,000 channels have a ranking parameter value less than or equal to 0.001, then the second threshold value may be set to 0.001; assuming the preset value is 50, and among the 10,000 channels with a ranking parameter value less than or equal to 0.005 and greater than 0.001, only 6,000 channels have a total number of update items greater than 50 within 7 days, then the value of N may be 6000. In this way, the number of channels collected may be further controlled by setting the second threshold value and the preset value.
[0067] Step 230: performing data collection based on the first N webpage channels obtained.
[0068] In the embodiment of the present application, after the number N of webpage channels is determined, data collection is performed on the first N webpage channels, so that webpage channels with lower ranking parameter values but a higher total number of update items updated within a unit statistical period can be further collected.
[0069] The data collection method provided in the embodiment of the present application can screen out the top N webpage channels that are relatively valuable (i.e., meet the preset conditions in one or some dimensions) from the webpage channels with relatively small sorting parameter values (i.e., less than or equal to the first threshold value but greater than the second threshold value) by determining the sorting parameter values of the webpage channels and obtaining the top N webpage channels whose sorting parameter values are less than or equal to the first threshold value and greater than the second threshold value, and whose number of update items meets the preset conditions. This ensures that webpage channels with relatively small sorting parameter values but meeting the requirements in some aspects can also be screened out, thereby expanding the collection scope of the webpage channels and avoiding the omission of relatively valuable webpage channels.
[0070] In one embodiment of the present application, the time interval for obtaining the first M web channels may be a first preset period, and the time interval for obtaining the first N web channels may be a second preset period, and the first preset period may be different from the second preset period.
[0071] It should be understood that, in actual application, the second preset period may be shorter than the first preset period, or longer than the first preset period. For example, the time interval for acquiring the first M web channels may be 20 minutes, and the time interval for acquiring the first N web channels may be 6 minutes. In other words, the frequency of acquiring the first N web channels may be greater than the frequency of acquiring the first M web channels. In this way, supplementary data collection may be performed on web channels whose ranking parameter values are not as high as the first M web channels but whose total number of update items updated in a unit statistical period is higher.
[0072] Figure 3 is a flow chart of a data collection method provided in an embodiment of the present application. Figure 3 ,exist Figure 1 or Figure 2 On the basis of, the data collection method provided in the embodiment of the present application may also include:
[0073] Step 310: Acquire all webpage channels every third preset period.
[0074] The size of the third preset period can be set according to the actual application. For example, the third preset period can be the same as the first preset period, or the same as the second preset period, or greater than the first preset period. In actual applications, the third preset period can be the largest relative to the first preset period and the second preset period, that is, the third preset period can be greater than the second preset period and the first preset period at the same time.
[0075] According to the above examples, the first preset period may be 20 minutes, the second preset period may be 6 minutes, and the third preset period may be 60 minutes; that is, all web channels are acquired every 60 minutes.
[0076] Step 320: data collection based on all acquired webpage channels.
[0077] In an embodiment of the present application, based on all webpage channels acquired every third preset period, data collection can be performed on all webpage channels to fill in the gaps and collect data on webpage channels that are not updated or updated less frequently within a unit statistical period.
[0078] The data collection method provided in the embodiment of the present application can collect data from all webpage channels every third preset period, so as to further check for omissions and fill in the gaps in the first two data collection methods, and collect data from webpage channels that have not been updated or have been updated less frequently within the unit statistical period.
[0079] Optionally, in one embodiment of the present application, before determining the ranking parameter value of the web channel, the data collection method provided by the embodiment of the present application may further include pre-processing of the web channel. Specifically, first, the links and titles of the web channel may be simply filtered, and some web channels that do not meet the link specification may be eliminated. For example, http: / / .anjuke.com / help / question, the format of this link is incorrect, and it may be filtered out first. Then, the links of the web channel may be de-duplicated, for example, a Bloom filter module (reids-bloom) component may be used to complete de-duplication, that is, duplicate links may be removed. Afterwards, the links that have not been processed (i.e., the remaining links) may be predicted to obtain a prediction result, and the prediction result may be used to indicate whether the link belongs to a web channel link. Through prediction, a link belonging to a web channel may be found from the link. The predicted result here may be a web channel homepage link (for example, a link that may be a channel homepage entrance link), a specific link under a web channel (a link indicating a valuable page (e.g., news, post) under a web channel), and a non-channel link. Since there may be errors and omissions in the prediction, strong rules can be formulated to filter the links and titles of webpage channels for the links and titles predicted to belong to webpage channels. These rules can be, for example, title rules such as "Uniform Publication Number", "Postal Code", "Advertisement", "Copyright", "All Rights Reserved", "Copyright Statement", "Solemn Statement", etc., and can also be filtering rules, for example, the channels with more than a specified number of pages, such as 5 pages, in news and forums can be filtered out. Afterwards, the number of webpage channels under the domain name can also be recorded, and webpage channels that exceed the collection number limit value will no longer be entered (i.e., not as target webpage channels).
[0080] In addition, data collection can be performed on the links and titles of the web page channels that have completed pre-processing, and the depth of the parsed links and titles can be recorded. If data collection is performed without depth, the collection depth value of the web page channel can be 0; and the depth of the parsed links and titles can be 1. Among them, parameter information such as the channel sorting parameter value, the total number of update items updated within a unit statistical period, the number of update items updated this time, the collection depth value, and the number of channels under the domain name can be updated in the remote dictionary service (Remote Dictionary Server, Redis) database for storage, and read from the remote dictionary service when these parameters are needed.
[0081] In this way, more valuable web channels can be screened out for subsequent data collection through pre-processing of web channels, thereby improving the efficiency of data collection for web channels.
[0082] The data collection method provided by the embodiment of the present application is further described in detail below in combination with actual application scenarios. Figure 4 As shown, the data collection method provided in the embodiment of the present application may include the following steps:
[0083] Step 410, obtaining the collection depth value and collection number limit value of the webpage channel.
[0084] Before step 410, the data collection method provided by the embodiment of the present application may also include pre-processing of the web channel. Specifically, first, the links and titles of the web channel can be simply filtered, and some web channels that do not meet the link specifications can be eliminated. For example, http: / / .anjuke.com / help / question, the format of this link is incorrect, and it can be filtered out first. Then the links of the web channel can be de-duplicated, for example, the Bloom filter module (reids-bloom) component can be used to complete the de-duplication judgment, that is, to remove the duplicate links. After that, the links that have not been processed (that is, the remaining connections) can be predicted to obtain a prediction result, and the prediction result can be used to indicate whether the link belongs to the web channel. Through prediction, the link belonging to the web channel can be found from the link. The predicted result here can be a web channel link (for example, a link to the channel homepage entrance), a specific link under the web channel (a link indicating a valuable page (such as news, post) under the web channel), and a non-channel link. Since there may be errors and omissions in the prediction, strong rules can be formulated to filter the links and titles of webpage channels for the links and titles predicted to belong to webpage channels. These rules can be, for example, title rules such as "Uniform Publication Number", "Postal Code", "Advertisement", "Copyright", "All Rights Reserved", "Copyright Statement", "Solemn Statement", etc., and can also be filtering rules, for example, the channels with more than a specified number of pages, such as 5 pages, in news and forums can be filtered out. Afterwards, the number of webpage channels under the domain name can also be recorded, and webpage channels that exceed the collection number limit value will no longer be entered (i.e., not as target webpage channels).
[0085] Step 420: Acquire multiple target webpage channels based on the acquisition depth value and the acquisition number limit value.
[0086] Step 430: Determine a ranking parameter value of each web page channel based on the number of update items of each web page channel in the plurality of target web page channels.
[0087] Step 440: acquiring the first M webpage channels whose ranking parameter values are greater than a first threshold value every first preset period, where M is a positive integer.
[0088] Step 450: collect data based on the first M webpage channels obtained.
[0089] Step 460: acquiring the first N webpage channels whose ranking parameter value is less than or equal to the first threshold and greater than the second threshold and whose number of update items meets a preset condition at every second preset period.
[0090] Step 470: performing data collection based on the first N webpage channels obtained.
[0091] It should be understood that the order of steps 440-450 and steps 460-470 can be selected according to actual conditions and is not limited here. For example, after step 430, steps 440-450 can be performed first, and then steps 460-470; or, after step 430, steps 460-470 can be performed first, and then steps 440-450; or, after step 430, steps 440-450 and steps 460-470 can be performed simultaneously.
[0092] Step 480: Acquire all webpage channels every third preset period.
[0093] Step 490: collect data based on all acquired webpage channels.
[0094] It should be understood that the order of steps 480-490 can be selected according to actual conditions and is not limited here. For example, steps 480-490 can be performed after steps 410-470; or, steps 480-490 can be performed before steps 410-470; or, steps 410-470 can be performed simultaneously with steps 480-490.
[0095] In the embodiment of the present application, the server providing web page service may include a main sending logic, a secondary sending logic and a supplementary sending logic. The main sending logic may send 30,000 web page channels with a sorting parameter value greater than 0.005 every 20 minutes. The main sending logic is the most important sending logic, so that web page channels with high sorting parameter values can be continuously sent. The secondary sending logic may send 20,000 web page channels with a sorting parameter value less than or equal to 0.005 and greater than 0.001 every 6 minutes, and the total number of update items updated within 7 days is greater than 50. The secondary sending logic may send web page channels with low sorting parameter values but many updated data in history, thereby reducing the situation where web page channels with very small sorting parameter values cannot be sent due to the main sending logic. The supplementary sending logic may send 20,000 of all web page channels every hour. The purpose of the supplementary sending logic is to traverse all channels to prevent some web page channels from not being updated due to the sending logic. In addition, in order to reduce the occupation of network bandwidth resources during the day, the collected domain names may be sent at 3 a.m. every day. The rules for pre-processing web channels can be updated every 20 minutes; for example, the web channels that are manually set and do not need to be collected can be filtered. The information of the web channels can be reset every week, that is, the various parameters of the web channels, such as the sorting parameter value or the collection depth value, are calculated again every week. Finally, the data to be processed can be checked every 20 minutes to check whether the various calculated parameter values are abnormal, and to check whether the server's processor and memory are abnormal.
[0096] It should be understood that the order of the pre-processing process and the data collection process of the web channel can be set according to the actual application situation, and is not limited here. For example, the pre-processing and data collection of the web channel can be performed at the same time, and each task process can not interfere with each other.
[0097] In the embodiment of the present application, the pre-processing of the web page channel mainly relies on the prediction process, and the prediction process adopts batch processing. Compared with a single prediction, batch processing has a higher execution speed, thereby improving the efficiency of processing the web page channel.
[0098] In addition, in the case of actual application, the data collection method can be applied to a server and can be executed by a crawler deployed on the server. The delivery of web page channels can be realized by the main delivery module, the secondary delivery module and the supplementary delivery module of the server providing web page services. Among them, the main delivery module is based on the idea that the web page channels with the highest ranking of the sorting parameter values are continuously delivered and handed over to a computer program such as a crawler for data collection, so that the web page channels with high sorting parameter values can be continuously collected and the latest data can be continuously collected. However, since it is possible to quickly deliver the channel twice, or although the channel quality is high, the data is collected in a time period with few updates (such as early morning), the sorting parameter value of the collected channel will be very low; therefore, the web page channels with a lot of updated data in the history can be delivered in the secondary delivery module. Even if the above two modules can complete the dispatch of most of the normal channels, there are still some channels whose sorting parameter values are 0 due to scheduling reasons (for example, the web page channel has no updated data within 5 days), so all web page channels need to be traversed to prevent omissions and reduce accidental factors. Accordingly, a server deployed with a program similar to a crawler can receive instructions sent by a server providing web page services or actively acquire web page channels. For example, a crawler can periodically collect web page channels with high ranking parameter values to continuously collect the latest data. The collection period can be the first preset period and / or the second preset period mentioned above. That is, the first M web page channels whose ranking parameter values mentioned above are greater than the first threshold can be collected in the first preset period, and the first N web page channels whose ranking parameter values mentioned above are less than or equal to the first threshold and greater than the second threshold, and the number of update items meets the preset conditions, can be collected in the second preset period. All web page channels can also be acquired in the third preset period.
[0099] The data collection method provided in the embodiment of the present application can obtain web pages with relatively high values from massive web pages according to the size of the sorting parameter value by calculating the sorting parameter value of the web page channel, so as to collect data in a more targeted manner and improve the efficiency of data collection for web pages; it can also expand the collection scope of web pages by obtaining web pages with relatively small sorting parameter values but meeting the needs in some aspects, thereby avoiding missing relatively valuable web pages; at the same time, data can be collected from all web pages every third preset period, so as to further check for omissions in the first two data collection methods and collect data from web pages that have not been updated or have been updated less frequently within the unit statistical period.
[0100] Figure 5 This is a structural block diagram of a data acquisition device provided in an embodiment of the present application. Figure 5A data acquisition device 500 provided in an embodiment of the present application may include: a determination module 510, an acquisition module 520 and a data acquisition module 530.
[0101] Wherein, the determination module 510 is used to determine the ranking parameter value of the webpage channel based on the number of update items of the webpage channel;
[0102] The acquisition module 520 is used to acquire the first M webpage channels whose ranking parameter values are greater than a first threshold;
[0103] The data collection module 530 is used to collect data based on the first M webpage channels obtained;
[0104] Wherein, M is a positive integer.
[0105] The data collection method provided in the embodiment of the present application determines the ranking parameter value of the webpage channel based on the number of update items of the webpage channel; obtains the first M webpage channels whose ranking parameter value is greater than the first threshold; and performs data collection based on the obtained first M webpage channels; wherein M is a positive integer. In this way, the ranking parameter value of the webpage channel can be calculated, and data collection can be performed according to the size of the ranking parameter value, so that data collection can be performed more targeted, and the efficiency of data collection for the webpage channel can be improved.
[0106] Optionally, in one embodiment, after determining the ranking parameter value of the webpage channel, the acquisition module 520 may also be used to: acquire the first N webpage channels whose ranking parameter value is less than or equal to the first threshold value and greater than the second threshold value, and whose number of update items meets the preset condition; the data acquisition module 530 may also be used to: perform data acquisition based on the acquired first N webpage channels; wherein the first threshold value is greater than the second threshold value, and N is a positive integer. In this way, by determining the ranking parameter value of the webpage channel and acquiring the first N webpage channels whose ranking parameter value is less than or equal to the first threshold value and greater than the second threshold value, and whose number of update items meets the preset condition, the first N webpage channels with relatively valuable values (i.e., meeting the preset condition in one or some dimensions) can be screened out from the webpage channels with relatively small ranking parameter values (i.e., less than or equal to the first threshold value but greater than the second threshold value), thereby ensuring that those webpage channels with relatively small ranking parameter values but meeting the requirements in one aspect can also be screened out, thereby expanding the collection scope of the webpage channels and avoiding the omission of relatively valuable webpage channels.
[0107] Optionally, in one embodiment, the number of update items may include: the number of first update items updated within a unit statistical period and the number of second update items updated this time; the determination module 510 may be specifically used to: use the ratio of the number of the second update items to the number of the first update items as the ranking parameter value of the web page channel. In this way, the ranking parameter value of the web page channel can be determined by the number of the second update items updated this time and the number of the first update items updated within the unit statistical period. Since the ranking parameter value of the web page channel is determined by the ratio of the number of the second update items to the number of the first update items, the ranking parameter value can intuitively reflect the proportion of the number of the second update items updated this time to the number of the first update items updated within the unit statistical period. The larger the proportion, the higher the proportion of the number of the second update items updated this time. Generally speaking, the web page channels with a high proportion of this update are the web page channels targeted by data collection, and the value is relatively high. Data can be collected from these web page channels first. In this way, by obtaining web page channels with relatively high values from massive web page channels through ranking parameter values, data collection can be performed on web page channels in a more targeted manner.
[0108] Optionally, in one embodiment, the acquisition time interval of the first M webpage channels may be a first preset period, and the acquisition time interval of the first N webpage channels may be a second preset period, and the first preset period is different from the second preset period. In this way, by acquiring webpage channels through two different acquisition periods: the first preset period and the second preset period, it can be ensured that webpage data with different focuses can be acquired on the one hand, and on the other hand, the data acquisition can be more comprehensive by staggering the acquisition periods to avoid missing some important data.
[0109] Optionally, in one embodiment, the number of update items may include the total number of update items updated in a unit statistical period, and the preset condition may include: the total number of update items updated in a unit statistical period is greater than a preset value. In this way, it can be ensured that the total number of update items of the screened webpage channels in the unit statistical period is not too small, thereby ensuring that webpage channels with relatively small sorting parameter values but meeting the requirements in terms of the total number of update items can also be screened out, thereby better meeting the user's requirements for various webpage channels.
[0110] Optionally, in one embodiment, the acquisition module 520 may also be used to: acquire all webpage channels every third preset period; the data collection module 530 may also be used to: perform data collection based on all acquired webpage channels. In this way, data collection may be performed on all webpage channels every third preset period, so that the first two data collection methods may be further checked for omissions and gaps, and data may be collected on webpage channels that have not been updated or have been updated less frequently within a unit statistical period.
[0111] Optionally, in one embodiment, before determining the ranking parameter value of the webpage channel based on the number of update items of the webpage channel, the acquisition module 520 may also be used to: acquire the acquisition depth value and the acquisition number limit value of the webpage channel; acquire multiple target webpage channels based on the acquisition depth value and the acquisition number limit value; the determination module 510 may also be used to: determine the ranking parameter value of each webpage channel based on the number of update items of each webpage channel in the multiple target webpage channels. In this way, the required multiple target webpage channels can be determined by the acquisition depth value and the acquisition number limit value of the webpage channel, and the ranking parameter value can be determined only for these webpage channels, without determining the ranking parameter value for all webpage channels. These multiple target webpage channels may be webpage channels that need to be included. In this way, by determining the ranking parameter value only for the included webpage channels, the range of webpage channels that need to determine the ranking parameter value can be narrowed, thereby reducing the workload of calculation. At the same time, by setting the acquisition depth value and the acquisition number limit value of the webpage channel, the needs of users can be better met.
[0112] It should be noted that the data acquisition device provided in the embodiment of the present application corresponds to the data acquisition method mentioned above. The relevant content can refer to the description of the data acquisition method above, and will not be repeated here.
[0113] In addition, if Figure 6 As shown, the embodiment of the present application also provides a server 600, and the server 600 includes: a processor 610, a memory 620, and a program or instruction stored in the memory 620 and running on the processor 610, and the program or instruction is executed by the processor 610 to implement the steps of any of the methods described above. For example, when the program is executed by the processor 620, the following process is implemented: based on the number of update items of the web channel, determine the sorting parameter value of the web channel; obtain the first M web channels whose sorting parameter value is greater than the first threshold; based on the obtained first M web channels, perform data collection; wherein M is a positive integer. In this way, by calculating the sorting parameter value of the web channel, data collection can be performed according to the size of the sorting parameter value, so that data collection can be performed more targeted, and the efficiency of data collection for the web channel can be improved.
[0114] The embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by the processor 610, the steps of any of the methods described above are implemented. For example, when the program is executed by the processor 610, the following process is implemented: based on the number of update items of the web channel, the sorting parameter value of the web channel is determined; the first M web channels whose sorting parameter value is greater than the first threshold are obtained; based on the first M web channels obtained, data collection is performed; wherein M is a positive integer. In this way, the sorting parameter value of the web channel can be calculated, and data collection can be performed according to the size of the sorting parameter value, so that data collection can be performed more targeted, thereby improving the efficiency of data collection for web channels.
[0115] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0116] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0117] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0118] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0119] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0120] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0121] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0122] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0123] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0124] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A data collection method, characterized in that: include: Determining a ranking parameter value of the web channel based on the number of update items of the web channel; Obtain the first M webpage channels whose ranking parameter values are greater than a first threshold; Based on the obtained first M webpage channels, data collection is performed; Wherein, M is a positive integer; The number of update items includes: the number of first update items updated within a unit statistical period and the number of second update items updated this time; determining the sorting parameter value of the web channel based on the number of update items of the web channel includes: taking the ratio of the second number of update items to the first number of update items as the sorting parameter value of the web channel.
2. The method according to claim 1, characterized in that After determining the ranking parameter value of the webpage channel, the method further includes: Acquire the top N webpage channels whose ranking parameter value is less than or equal to the first threshold and greater than the second threshold, and whose number of update items meets a preset condition; Based on the obtained first N webpage channels, data collection is performed; The first threshold is greater than the second threshold, and N is a positive integer.
3. The method according to claim 2, characterized in that The time interval for acquiring the first M webpage channels is a first preset period, and the time interval for acquiring the first N webpage channels is a second preset period. The first preset period is different from the second preset period.
4. The method according to claim 2, characterized in that: The number of update items includes the total number of update items updated in a unit statistical period, and the preset condition includes: the total number of update items updated in the unit statistical period is greater than a preset value.
5. The method according to claim 3, characterized in that: The method further comprises: Obtaining all webpage channels every third preset period; Data collection is performed based on all acquired web channels.
6. The method according to claim 1, characterized in that Before determining the ranking parameter value of the webpage channel based on the number of update items of the webpage channel, the method further includes: Get the collection depth value and collection number limit value of the web channel; Based on the acquisition depth value and the acquisition number limit value, acquiring multiple target web page channels; The step of determining the ranking parameter value of the webpage channel based on the number of update items of the webpage channel includes: Based on the number of update items of each web page channel in the plurality of target web page channels, a ranking parameter value of each web page channel is determined.
7. A data acquisition device, characterized in that: include: A determination module, used to determine a ranking parameter value of a webpage channel based on the number of update items of the webpage channel; An acquisition module, used for acquiring the first M webpage channels whose ranking parameter values are greater than a first threshold; A data collection module, used for collecting data based on the first M webpage channels obtained; Wherein, M is a positive integer; The number of update items includes: the number of first update items updated in a unit statistical period and the number of second update items updated this time; the determination module is specifically used to: use the ratio of the second number of update items to the first number of update items as the ranking parameter value of the web page channel.
8. A server, characterized in that: The method comprises a processor, a memory, and a program or instruction stored in the memory and running on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method according to any one of claims 1 to 6.
9. A readable storage medium, characterized in that: The readable storage medium stores a program or instruction, and when the program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Webpage acquisition method and device
CN113343141A
