A method, system and storage medium for directional data collection and regularization
Through directional data collection and regularization methods, the problem of scattered data acquisition is solved, data is automatically collected and optimized, information is summarized, and the convenience of information acquisition and user experience are improved.
Patent Information
- Application Number
- CN202410023848.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-05
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2044-01-05
AI Technical Summary
The existing data acquisition methods are fragmented, making it difficult for users to obtain complete report information from different link addresses, affecting the convenience of information acquisition and user experience.
Provide a directional data collection and regularization method, by obtaining the link address to be collected, determining the collection strategy according to the data structure type, performing data extraction, integrity check and repair, outputting the optimized data collection, and summarizing scattered information.
It realizes automatic collection and optimization of data, summarizes information from different link addresses, and improves the convenience of information acquisition and user experience.
Smart Images

Figure CN117972179B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a method, system and storage medium for directional data collection and regularization. Background Art
[0002] With the development of Internet technology, website data has become more complex. Users sometimes want to know the overall information about a certain event at home and abroad. They need to search for data in a certain section of the corresponding website or the data of the entire website on the browser to read the corresponding data information. However, users need to search for relevant information from different link addresses to read all the relevant information about a certain event. That is, the existing data acquisition method is relatively scattered and inconvenient for users to view. Summary of the invention
[0003] The present application aims to solve at least one of the technical problems existing in the prior art. To this end, the present application proposes a method, system and storage medium for directional data collection and regularization, which can improve the convenience of information acquisition and the user experience.
[0004] In a first aspect, the present application provides a method for directional data collection and regularization, comprising:
[0005] Get several link addresses to be collected;
[0006] Determining a data collection strategy according to the data structure type of the link address;
[0007] According to the data collection strategy, extracting data content preset in the link address to obtain a first data set;
[0008] Performing integrity check and repair on the first data set to obtain a second data set;
[0009] The second data set obtained from all the link addresses is output.
[0010] According to the directional data collection and regularization method of the first aspect of the present application, there are at least the following beneficial effects: obtaining several link addresses to be collected input by the user, determining the data collection strategy according to the data structure type of the link address, extracting the data content preset in the link address according to the data collection strategy to obtain a first data set, performing integrity check and repair on the first data set to obtain a second data set, and outputting the second data set obtained from all the link addresses. Through the above-mentioned directional data collection and regularization method, it is possible to automatically collect a first data set about the reporting information from the provided link address, optimize the first data set to improve integrity and form a second data set, output the second data set obtained from all link addresses, and organize and centralize the scattered reporting information from different link addresses, thereby improving the convenience of information acquisition and the user experience.
[0011] According to some embodiments of the first aspect of the present application, the data structure type is a static web page structure; the data extraction of the preset content in the link address to obtain the first data set includes: directly rendering and extracting the preset content in the link address to obtain the first data set.
[0012] According to some embodiments of the first aspect of the present application, the data structure type is a dynamic web page structure; the data extraction of the preset content in the link address to obtain the first data set includes: asynchronously rendering and extracting data of the preset content in the link address to obtain the first data set.
[0013] According to some embodiments of the first aspect of the present application, the data structure type is an encrypted web page structure, and the data collection strategy is a decoding strategy customized according to the encryption type of the link address; the data extraction of the preset content in the link address to obtain the first data set includes: extracting the preset content in the link address to obtain an encrypted data set; and performing content conversion on the encrypted data set using the preset decoding strategy to obtain the first data set.
[0014] According to some embodiments of the first aspect of the present application, the data content includes an article link, an article publishing time, an article title and an article text; according to the data collection strategy, data is extracted from the data content preset in the link address to obtain a first data set, including: according to the data collection strategy, searching for the data locations of the article link, the article publishing time, the article title and the article text respectively; according to the data location, data is extracted from the contents of the article link, the article publishing time, the article title and the article text respectively to obtain the first data set.
[0015] According to some embodiments of the first aspect of the present application, the integrity check and repair of the first data set to obtain the second data set includes: determining whether the content of the article link, the article publishing time, the article title and the article text of the first data set is empty; when the content of the article link, the article publishing time, the article title and the article text are not empty, taking the first data set as the second data set; when one of the article link, the article publishing time, the article title or the article text is empty, re-extracting the data content with empty content using a preset local collection strategy to form the second data set.
[0016] According to some embodiments of the first aspect of the present application, the integrity check and repair of the first data set to obtain the second data set includes: performing an integrity check and repair on the first data set to obtain an original data set; when the language of the article title and the article body of the original data set is Chinese, the original data set is used as the second data set; when the language of the article title and the article body of the original data set is not Chinese, calling a preset language translation interface to translate the content of the article title and the article body to form the second data set.
[0017] According to some embodiments of the first aspect of the present application, the output of the second data set obtained from all the link addresses includes: packaging and outputting the second data set collected from different link addresses within a preset first time interval with the first time interval as a period.
[0018] In the second aspect, the present application also provides a directional data acquisition system, comprising: at least one memory; at least one processor; at least one program; the program is stored in the memory, and the processor executes at least one program to implement the directional data acquisition regularization method as described in any embodiment of the first aspect.
[0019] In a third aspect, the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer-executable signal, and the computer-executable signal is used to execute the directional data collection and regularization method as described in any embodiment of the first aspect.
[0020] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Additional aspects and advantages of the present application will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0022] Figure 1 A flowchart of a method for collecting and regularizing directional data according to an embodiment of the present application;
[0023] Figure 2 A flowchart of a method for collecting and regularizing directional data according to another embodiment of the present application;
[0024] Figure 3 A flowchart of a method for collecting and regularizing directional data according to another embodiment of the present application;
[0025] Figure 4 A flowchart of a method for collecting and regularizing directional data according to another embodiment of the present application;
[0026] Figure 5 A flowchart of a directional data collection and regularization method according to another embodiment of the present application. DETAILED DESCRIPTION
[0027] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, and cannot be understood as limiting the present application.
[0028] In the description of the present application, it should be understood that descriptions involving orientation, such as up, down, front, back, left, right, etc., indicating orientations or positional relationships, are based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present application.
[0029] In the description of this application, if there is a description of first or second, it is only for the purpose of distinguishing technical features, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features or implicitly indicating the order of the indicated technical features.
[0030] In the description of this application, unless otherwise clearly defined, terms such as setting, installing, connecting, etc. should be understood in a broad sense, and technicians in the relevant technical field can reasonably determine the specific meanings of the above terms in this application based on the specific content of the technical solution.
[0031] With the development of Internet technology, website data has become more complex. Users sometimes want to know the overall information about a certain event at home and abroad. They need to search for data in a certain section of the corresponding website or the data of the entire website on the browser to read the corresponding data information. However, users need to search for relevant information from different link addresses to read all the relevant information about a certain event. That is, the existing data acquisition method is relatively scattered and inconvenient for users to view.
[0032] Based on this, the present application provides a directional data collection and regularization method, system and storage medium to solve the above-mentioned technical problems. The technical solutions proposed in this application are explained one by one below.
[0033] In a first aspect, the present application provides a method for directing data rules, including but not limited to the following steps:
[0034] Step S110: obtaining a number of link addresses to be collected;
[0035] Step S120: determining a data collection strategy according to the data structure type of the link address;
[0036] Step S130: extracting data from the preset data content in the link address according to the data collection strategy to obtain a first data set;
[0037] Step S140: performing integrity check and repair on the first data set to obtain a second data set;
[0038] Step S150: Output the second data set obtained from all link addresses.
[0039] It should be noted that some link addresses can be for a certain event, such as continuous attention to check local government reports on real estate, finance, education, and technology, and the direction of public opinion on the relevant reports of the event in mainstream media headlines and official self-media accounts on Weibo, and the overall direction and trend of a certain event. The corresponding website is equivalent to the link address of the relevant website reporting on this event. The website is a series, which can be multiple provinces, cities, and overseas websites reporting on this type of data.
[0040] Acquire several link addresses to be collected input by the user, determine the data collection strategy according to the data structure type of the link address, extract the data content preset in the link address according to the data collection strategy, obtain the first data set, perform integrity check and repair on the first data set, obtain the second data set, and output the second data set obtained from all link addresses. Through the above-mentioned directional data collection and regularization method, the first data set about the reported information can be automatically collected from the provided link address, and the first data set is optimized to improve the integrity and form the second data set, and the second data set obtained from all link addresses is output, and the scattered reported information from different link addresses is regularized and concentrated together, which improves the convenience of information acquisition and the user experience.
[0041] It can be understood that the data structure type is a static webpage structure; the step of extracting data content preset in the link address to obtain the first data set in step S130 may also include but is not limited to the following steps:
[0042] Step S210: directly rendering and extracting data from the preset content in the link address to obtain a first data set.
[0043] Static web pages are fixed contents generated on the server side and sent to the client side, and the contents do not change when displayed on the client side. In step S210, the basic crawling function can be implemented by writing a small amount of code. The page can obtain the required content, such as text and pictures, by directly rendering. This can usually quickly obtain static web page content. In one embodiment, it can simulate the browser sending a request by calling the library and defining the application header to obtain the source code of the target web page, and locate the element information in the source code to extract the required data from the entire HTML document. The specific data collection method is not specifically limited in this application.
[0044] It can be understood that the data structure type is a dynamic web page structure; the step of extracting data content preset in the link address to obtain the first data set in step S130 may also include but is not limited to the following steps:
[0045] Step S220: asynchronously render and extract data from the preset content in the link address to obtain a first data set.
[0046] Dynamic web pages dynamically generate and update content through scripting technologies such as JavaScript during the client loading and rendering process. Asynchronous rendering is a way of loading content on a web page. In layman's terms, it does not need to wait for the current content to be loaded before continuing to load other content. That is, when a block of content in a page is reverse loaded, it means that the page is not loaded together with the block of content when it is initially loaded. Instead, when the user scrolls the page or performs certain operations, it dynamically requests new content from the server and then displays it on the page. Data is collected after the page is rendered asynchronously to obtain the first data set. Similarly, this application does not limit the specific data collection method of the link address of the dynamic web page structure.
[0047] It can be understood that the data structure type is an encrypted webpage structure, and the data collection strategy is a decoding strategy customized according to the encryption type of the link address; the step of extracting data content preset in the link address to obtain the first data set in step S130 may also include but not limited to the following steps:
[0048] Step S230: extracting data from preset contents in the link address to obtain an encrypted data set; converting the contents of the encrypted data set using a preset decoding strategy to obtain a first data set.
[0049] In some embodiments of the present application, for example, the body of the acquired data is encrypted and not normal text, so it is necessary to convert such data into normal text. For another example, the request parameters of the website are inconsistent every time according to the dynamic changes over time, and the format of the website is relatively special. For another example, the article is inserted in other places and the data information cannot be obtained through conventional extraction, etc. For encrypted websites, it is necessary to use a preset decoding strategy to convert the content according to different encryption types to obtain the first data information. It should be noted that the above decoding strategies are all based on the premise of legality and compliance, so as to convert the encrypted data set into the first data set.
[0050] It is understandable that the data content includes four elements, which are article link, article publishing time, article title and article body; in step S130, the following steps may be included but not limited to:
[0051] Step S310: searching for data locations of article links, article publishing time, article titles, and article texts respectively according to the data collection strategy;
[0052] Step S320: According to the data location, the article link, article publishing time, article title and article body content are extracted to obtain a first data set.
[0053] For the four elements in the data content, different data collection strategies can be adopted according to the data structure type of the link address to collect the article link, article release time, article title and article text respectively, and the collected results can be classified and combined according to the four elements to form a first data set.
[0054] It is understandable that step S140 may include but is not limited to the following steps:
[0055] Step S410: Determine whether the article link, article publishing time, article title and article body of the first data set are empty;
[0056] Step S420: when the article link, article publishing time, article title and article body are not empty, the first data set is used as the second data set;
[0057] Step S430: When one of the article link, article publishing time, article title or article body is empty, a preset local collection strategy is used to re-extract data from the empty data content to form a second data set.
[0058] In step S410 to step S430, after the extraction of the first data set is completed, in order to improve the accuracy and completeness of data collection, it is necessary to perform an integrity check on the first data set. When the four elements collected are incomplete, it is necessary to repair the data, that is, to complete the missing data. Specifically, it is determined whether the content of the article link, article publishing time, article title and article body of the first data set is empty. When the above four elements are not empty, it is considered that the data content of each part can be collected, and no processing is performed, and the first data set is used as the second data set. When one of the article link, article publishing time, article title or article body is empty, the preset local collection strategy is used to re-extract the data content with empty content to form a second data set. In some implementations of the present application, if the data content of the element part of the article body is empty, the commonly used storage text element tag can be used. , or judging whether it is the main text based on the regularity and compactness of the text in the tag (generally speaking, the main text is in one place). If it is greater than a preset threshold, it can be considered that this part of the content is the main text of the article that needs to be obtained; for example, if the data content of the element part of the article release time is empty, and the article release time is generally represented by an 11-digit or 13-digit timestamp, or there are keywords such as "year", "month", "day" and so on and it is in a relatively early position on the page, then it can be considered that this time is the article release time of the article extracted. The specific means of repairing and completing the four elements are not specifically limited in this application.
[0059] It is understandable that step S140 may include but is not limited to the following steps:
[0060] Step S510: performing integrity check and repair on the first data set to obtain an original data set;
[0061] Step S520: when the language of the article title and the article body of the original data set is Chinese, the original data set is collected as a second data set;
[0062] Step S530: When the language of the article title and the article body of the original data set is not Chinese, call a preset language translation interface to translate the content of the article title and the article body to form a second data set.
[0063] For foreign-language consulting reports, users need to translate them before reading when obtaining their specific content, which makes reading inefficient. In steps S510 to S530, after the integrity check and repair of the first data set, the original data set is obtained, and it is determined whether the article title and the article body in the original data set are in Chinese. When the corresponding language is Chinese, the original data set is output as the second data set. When the corresponding language is not Chinese, the preset language translation interface is called to translate the article title and the article body in the original data set into Chinese. The language translation interface can support translation of multiple foreign languages into Chinese, and the translated text is output as the second data set. Through the above steps, foreign-language consulting reports can be automatically translated, which improves the user's reading experience.
[0064] It is understandable that step S150 may include but is not limited to the following steps:
[0065] Taking the preset first time interval as a period, the second data sets collected from different link addresses within the first time interval are packaged and output.
[0066] Through the timing program, the collected second data information is sent to the designated recipient through the already written email program at regular intervals every first time interval, so that all the four-element data information that need to be regulated by the given link address can be viewed. The website can be the link address of an electronic newspaper, or the link address of the website corresponding to education on the official website of the governments of many places. What is finally returned in the form of an email or an excel table is the four-element information of the regular articles of these website links. According to the above-mentioned given website links, an intermediary checks how these websites are classified, whether the system simply implements some collection or requires a special collection method, and extracts the desired article data. The extracted series of regular data can be sent to the user regularly according to the frequency with which the user wants to view the data. For example, once a day, to see the latest reports on this event on these websites, the first time interval can be set to 24 hours, and this application does not make specific restrictions on this.
[0067] In a second aspect, the present application also provides a directional data collection and regularization system, comprising: at least one memory, at least one processor and at least one program, the program is stored in the memory, and the processor executes one or more programs to implement the above-mentioned directional data collection and regularization method.
[0068] Acquire several link addresses to be collected input by the user, determine the data collection strategy according to the data structure type of the link address, extract the data content preset in the link address according to the data collection strategy, obtain the first data set, perform integrity check and repair on the first data set, obtain the second data set, and output the second data set obtained from all link addresses. Through the above-mentioned directional data collection and regularization method, the first data set about the reported information can be automatically collected from the provided link address, and the first data set is optimized to improve the integrity and form the second data set, and the second data set obtained from all link addresses is output, and the scattered reported information from different link addresses is regularized and concentrated together, which improves the convenience of information acquisition and the user experience.
[0069] As a non-transient computer-readable storage medium, the memory can be used to store non-transient software programs, non-transient computer executable programs and signals, such as program instructions / signals corresponding to the processing module in the embodiment of the present application. The processor executes various functional applications and data processing by running the non-transient software programs, instructions and signals stored in the memory, that is, the directional data collection and regularization method of the above method embodiment is realized.
[0070] The memory may include a program storage area and a data storage area, wherein the program storage area may store an operating system and applications required by at least one function; the data storage area may store relevant data of the above-mentioned directional data acquisition and regularization method, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the processing module via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0071] One or more signals are stored in a memory, and when executed by one or more processors, the directional data acquisition and regularization method in any of the above method embodiments is executed.
[0072] In a third aspect, an embodiment of the present application provides a computer-readable storage medium, which stores computer-executable instructions. The computer-executable instructions are executed by one or more processors, enabling the one or more processors to execute the directional data collection and regularization method in the above method embodiment.
[0073] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, i.e., may be located in one place, or may be distributed over multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0074] Through the description of the above embodiments, it will be appreciated by those skilled in the art that all or some of the steps and systems in the disclosed methods above can be implemented as software, firmware, hardware and appropriate combinations thereof. Some physical components or all physical components can be implemented as software executed by a processor, such as a central processing unit, a digital signal processor or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software can be distributed on a computer-readable medium, and the computer-readable medium can include a computer storage medium (or a non-transitory medium) and a communication medium (or a temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as a computer-readable signal, a data structure, a program module or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cassette, magnetic tape, disk storage or other magnetic storage device, or any other medium that can be used to store desired information and can be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media generally embodies computer readable signals, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0075] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or plural.
[0076] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components 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 through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0077] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0078] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0079] The embodiments of the present application are described in detail above in conjunction with the accompanying drawings, but the present application is not limited to the above embodiments, and various changes can be made within the knowledge scope of ordinary technicians in the relevant technical field without departing from the purpose of the present application.
Claims
1. A method for regularizing directional data collection, It is characterized in that include: Get several link addresses to be collected; Determining a data collection strategy according to the data structure type of the link address; According to the data collection strategy, extracting data content preset in the link address to obtain a first data set; Performing integrity check and repair on the first data set to obtain a second data set; Outputting the second data set obtained from all the link addresses; The data content includes an article link, article publishing time, article title and article body; according to the data collection strategy, data is extracted from the preset data content in the link address to obtain a first data set, including: According to the data collection strategy, respectively searching for the data location of the article link, the article publishing time, the article title and the article body; According to the data location, extracting the article link, the article publishing time, the article title and the content of the article body respectively to obtain a first data set; The step of performing integrity check and repair on the first data set to obtain the second data set includes: Determine whether the article link, the article publishing time, the article title and the article body of the first data set are empty; When the article link, the article publishing time, the article title and the article body are not empty, the first data set is used as the second data set; When one of the article link, the article publishing time, the article title or the article body is empty, a preset local collection strategy is used to re-extract data from the empty data content to form the second data set.
2. The directional data collection and regularization method according to claim 1, It is characterized in that The data structure type is a static webpage structure; the data is extracted from the preset content in the link address to obtain a first data set, including: The preset content in the link address is directly rendered and data is extracted to obtain a first data set.
3. The directional data collection and regularization method according to claim 1, It is characterized in that The data structure type is a dynamic web page structure; the data is extracted from the preset content in the link address to obtain a first data set, including: Asynchronously rendering and extracting data from the preset content in the link address to obtain a first data set.
4. The directional data collection and regularization method according to claim 1, It is characterized in that The data structure type is an encrypted webpage structure, and the data collection strategy is a decoding strategy customized according to the encryption type of the link address; The step of extracting data from the preset content in the link address to obtain a first data set includes: Extracting data from the preset content in the link address to obtain an encrypted data set; The encrypted data set is subjected to content conversion using the preset decoding strategy to obtain a first data set.
5. The directional data collection and regularization method according to claim 1, It is characterized in that The performing integrity check and repair on the first data set to obtain a second data set includes: Performing integrity check and repair on the first data set to obtain an original data set; When the language of the article title and the article body of the original data set is Chinese, the original data set is used as the second data set; When the language of the article title and the article body of the original data set is not Chinese, a preset language translation interface is called to translate the content of the article title and the article body to form the second data set.
6. The directional data collection and regularization method according to claim 1, It is characterized in that The outputting the second data set obtained from all the link addresses includes: The second data sets collected from different link addresses within the first time interval are packaged and outputted at a preset first time interval.
7. A directional data acquisition system, It is characterized in that include: at least one memory; at least one processor; at least one program; The program is stored in the memory, and the processor executes at least one of the programs to implement the directional data collection and regularization method as described in any one of claims 1 to 6.
8. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer-executable signal, and the computer-executable signal is used to execute the directional data collection and regularization method as described in any one of claims 1 to 6.
