Method for acquiring internet data in one step

文档序号:7805 发布日期:2021-09-17 浏览:43次 中文

1. A method for one-step collecting internet data is characterized in that: the method comprises the following steps:

step 1: acquiring request parameters;

step 2: carrying out self-defined setting on request parameters for website retrieval;

and step 3: sending an access request to the website through the customized request parameters to obtain response information which is in accordance with the customized data display parameters;

and 4, step 4: acquiring website data at one time to obtain full data;

and 5: and structuring the obtained retrieval result information, and storing the retrieval result information in a database to achieve the purpose of data acquisition.

2. The method for one-step collection of internet data as claimed in claim 1, wherein: in the step 1, a search request or a page turning request sent to a target website is intercepted through a browser developer tool or a data packet capturing tool, and each request parameter name including a display upper limit of each page and the current page number is obtained.

3. The method for one-step collection of internet data as claimed in claim 1, wherein: in the step 2, the customized request parameters refer to numerical values having meanings related to display forms of website data to be collected, and include page numbers and upper limit display numbers of each page.

4. The method for one-step acquisition of internet data according to claim 1 or 3, wherein: in step 2, the upper limit of data display and the number of pages of the crawler program access request parameter are adjusted, the upper limit of display value greater than or equal to the total number of displayed websites is set, and the number of pages is set to 1.

5. The method for one-step collection of internet data as claimed in claim 4, wherein: in the step 3, after the values of the display upper limit and the page number are set by user, 1-time request is sent and website response data are obtained, the website response data are compared with the display contents of the corresponding webpages of the website, and whether the two are consistent or not is observed; and if the data are not matched with the data, ending the access and stopping the data acquisition.

6. The method for one-step collection of internet data as claimed in claim 1, wherein: and the response information in the step 3 is the total target data required to be collected.

7. The method for one-step collection of internet data as recited in claim 6, wherein: and (4) carrying out data processing on the total data acquired in the step (4), and extracting a target field to obtain retrieval result information.

8. The method for one-step collection of internet data as recited in claim 7, wherein: and 5, performing structured processing on the obtained retrieval result information, and storing the retrieval result information into a database to finish data acquisition.

Background

The modern society is a society with high development speed, along with the rapid development and the popularization and application of computers and information technologies, the scale of an industry application system is rapidly enlarged, data generated by industry application is explosively increased, people increasingly recognize the importance of the data, and the data concept has attracted the wide attention of practitioners and users in various industries. The mining and the application of mass data indicate the increase of the productivity of a new wave and the arrival of surplus wave of consumers. With the development of government information disclosure and enterprise digitization, a large amount of valuable data can be acquired through the collection of internet data.

Information Retrieval (Information Retrieval) generally refers to text Information Retrieval, including various aspects of Information storage, organization, presentation, query, access and the like, and the core of the Information Retrieval is text Information indexing and Retrieval. Historically, information retrieval has gone through a plurality of development stages from manual retrieval and computer retrieval to networking and intelligent retrieval at present. The information retrieval object expands the information content which is relatively closed, stable and consistent and is managed by an independent database to open, dynamic, fast to update, widely distributed and loosely managed Web content; the users of information retrieval are also expanded from original information professionals to the common public including business personnel, managers, teachers, students, professionals and the like, and the users put higher and more diversified requirements on information retrieval from results to modes. The need for adapting to networking, intelligence and personalization is a new trend of the development of the current information retrieval technology.

With the recent widespread of computer networks, multimedia information retrieval has been rapidly developed. The traditional data acquisition technology generally does not involve manual change of a website access request, namely, request access parameters are not manually modified according to acquisition requirements, and the website is traversed according to a default display form of a website page to acquire full target data.

Because the content of each large website is continuously expanded and the total data amount is continuously increased at present, the number of sending times required when a request is sent according to a website default display form to acquire response data is greatly increased. If the data acquisition program still extracts the full amount of target data according to the display parameters set by the website, the required data acquisition cost such as acquisition time, resource nodes, processing and the like is necessarily greatly increased.

Based on the above situation, the invention provides a method for acquiring internet data in one step.

Disclosure of Invention

In order to make up for the defects of the prior art, the invention provides a simple and efficient method for acquiring internet data in one step.

The invention is realized by the following technical scheme:

a method for one-step collecting internet data is characterized in that: the method comprises the following steps:

step 1: acquiring request parameters;

step 2: carrying out self-defined setting on request parameters for website retrieval;

and step 3: sending an access request to the website through the customized request parameters to obtain response information which is in accordance with the customized data display parameters;

and 4, step 4: acquiring website data at one time to obtain full data;

and 5: and structuring the obtained retrieval result information, and storing the retrieval result information in a database to achieve the purpose of data acquisition.

In the step 1, a search request or a page turning request sent to a target website is intercepted through a browser developer tool or a data packet capturing tool, and each request parameter name including a display upper limit of each page and the current page number is obtained.

In the step 2, the customized request parameters refer to numerical values having meanings related to display forms of website data to be collected, and include page numbers and upper limit display numbers of each page.

In step 2, the upper limit of data display and the number of pages of the crawler program access request parameter are adjusted, the upper limit of display value greater than or equal to the total number of displayed websites is set, and the number of pages is set to 1.

In the step 3, after the values of the display upper limit and the page number are set by user, 1-time request is sent and website response data are obtained, the website response data are compared with the display contents of the corresponding webpages of the website, and whether the two are consistent or not is observed; and if the data are not matched with the data, ending the access and stopping the data acquisition.

And the response information in the step 3 is the total target data required to be collected.

And (4) carrying out data processing on the total data acquired in the step (4), and extracting a target field to obtain retrieval result information.

And 5, performing structured processing on the obtained retrieval result information, and storing the retrieval result information into a database to finish data acquisition.

The invention has the beneficial effects that: the one-step internet data acquisition method breaks away from the limitation of the data display form of the website, and acquires the full target data of the website by one-time access by specifying the request parameters related to data display, so that the access request times are reduced to 1, the acquisition time is shorter, acquisition resource nodes are not occupied, data missing is avoided, the data can be acquired quickly and efficiently, the development of a crawler program is simplified or omitted, and convenience is provided for subsequent data storage and data analysis.

Drawings

In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.

Fig. 1 is a schematic diagram of a method for acquiring internet data in one step according to the present invention.

Detailed Description

In order to make those skilled in the art better understand the technical solution of the present invention, the technical solution in the embodiment of the present invention will be clearly and completely described below with reference to the embodiment of the present invention. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.

The method for acquiring the internet data in one step comprises the following steps:

step 1: acquiring request parameters;

step 2: carrying out self-defined setting on request parameters for website retrieval;

and step 3: sending an access request to the website through the customized request parameters to obtain response information which is in accordance with the customized data display parameters;

and 4, step 4: acquiring website data at one time to obtain full data;

and 5: and structuring the obtained retrieval result information, and storing the retrieval result information in a database to achieve the purpose of data acquisition.

In the step 1, a search request or a page turning request sent to a target website is intercepted through a browser developer tool or a data packet capturing tool, and request parameter names including a display upper limit of each page and the current page number, such as pageSize and pageNo, are obtained.

In the step 2, the customized request parameters refer to numerical values having meanings related to display forms of website data to be collected, and include page numbers and upper limit display numbers of each page.

In step 2, the upper limit of data display and the number of pages of the crawler program access request parameter are adjusted, the upper limit of display value greater than or equal to the total number of displayed websites is set, and the number of pages is set to 1.

Theoretically, the value of the display upper limit of each page should be larger than or equal to the total amount of the target data, and can be set according to the acquisition requirement. For example, a website has 20 ten thousand pages of data, and default display of 10 pages of data per page has 2 ten thousand pages. If the upper limit of the display of each page is self-defined to be 20000 and the number of pages is 1, the full amount of data can be obtained by sending 1 search request.

In the step 3, after the values of the display upper limit and the page number are set by user, 1-time request is sent and website response data are obtained, the website response data are compared with the display contents of the corresponding webpages of the website, and whether the two are consistent or not is observed; and if the data are not matched with the data, ending the access and stopping the data acquisition.

For example, a website has 20 ten thousand pages of data, and default display of 10 pages of data per page has 2 ten thousand pages. If the upper limit of display is 20000 and the number of pages is 1, a total of 20 ten thousand pieces of data can be obtained after 1 search request is sent. If the data obtained by the spot check is consistent with the content displayed on the website page, the method is applicable.

The one-time request for acquiring the full data means that the number of access requests required to be sent for acquiring the full data openly displayed by the website only needs 1.

And the response information in the step 3 is the total target data required to be collected.

And (4) carrying out data processing on the total data acquired in the step (4), and extracting a target field to obtain retrieval result information.

And 5, performing structured processing on the obtained retrieval result information, and storing the retrieval result information into a database to finish data acquisition.

The structured information means that the information can be decomposed into a plurality of components which are mutually related after being analyzed, and each component has a clear hierarchical structure, the use and maintenance of the hierarchical structure are managed through a database, and certain operation specifications are provided. Structured data is simply a database. The structured information society is characterized in that the whole social, economic and cultural activities can be completed in the ordered interaction of various information, and the information is structured, ordered and interactive. In the step 5, the structuring of the full-scale data means that a hierarchical structure of the full-scale data is constructed to be ordered structured information.

Compared with the prior art, the method for acquiring the internet data in one step has the following characteristics:

firstly, the problems of long acquisition time, large occupation of resource nodes and target data missing caused by large acquisition range in the internet data acquisition process are solved; the method breaks away from the limitation of the data display form of the website, and adjusts the data display upper limit and the page number of the crawler program access request parameters, so that the whole target data of the website can be obtained by one-time access, the access request times are reduced to 1, the acquisition time is shorter, acquisition resource nodes are not occupied, the method is an optimized upgrade of the traditional internet data acquisition method, is a more efficient web crawler method, can avoid data missing, quickly and efficiently acquire data, simplifies or omits the development of the crawler program, and provides convenience for subsequent data storage and data analysis.

And secondly, the utilization efficiency of internet data is improved, the development of a crawler program is simplified or omitted in a data acquisition link by a big data researcher, the research and development cost is reduced, and convenience is provided for subsequent data storage, data analysis and other work.

The above-described embodiment is only one specific embodiment of the present invention, and general changes and substitutions by those skilled in the art within the technical scope of the present invention are included in the protection scope of the present invention.

完整详细技术资料下载
上一篇:石墨接头机器人自动装卡簧、装栓机
下一篇:一种基于爬虫的外挂精准标记与识别方法和装置

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!