WO2019071896A1 - 网页地址去重方法、电子设备及计算机可读存储介质 - Google Patents

网页地址去重方法、电子设备及计算机可读存储介质 Download PDF

Info

Publication number
WO2019071896A1
WO2019071896A1 PCT/CN2018/076170 CN2018076170W WO2019071896A1 WO 2019071896 A1 WO2019071896 A1 WO 2019071896A1 CN 2018076170 W CN2018076170 W CN 2018076170W WO 2019071896 A1 WO2019071896 A1 WO 2019071896A1
Authority
WO
WIPO (PCT)
Prior art keywords
node
webpage address
current node
processed
generalized table
Prior art date
Application number
PCT/CN2018/076170
Other languages
English (en)
French (fr)
Inventor
李芳�
王建明
肖京
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2019071896A1 publication Critical patent/WO2019071896A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/955Retrieval from the web using information identifiers, e.g. uniform resource locators [URL]
    • G06F16/9566URL specific, e.g. using aliases, detecting broken or misspelled links
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/951Indexing; Web crawling techniques

Definitions

  • the present application relates to the field of computer information technology, and in particular, to a web address deduplication method, an electronic device, and a computer readable storage medium.
  • the URL deduplication scheme commonly used by web crawlers has a database-based deduplication scheme and a memory linked list-based deduplication scheme, and these schemes have a good effect in the case where the URL library has a small capacity.
  • the existing distributed crawler-oriented URL library is usually very large, and requires URL deduplication to maintain efficient operation for a long time.
  • the above-mentioned common URL deduplication scheme will have a drastic drop or task after the crawler runs for a long time. The risk of embarrassment. Therefore, the design of the URL deduplication method in the prior art is not reasonable enough and needs to be improved.
  • the present application provides a web address deduplication method, an electronic device, and a computer readable storage medium.
  • a generalized table based on memory improvement for URL deduplication the time efficiency is much better than the traditional URL deduplication. Program.
  • the present application provides an electronic device including a memory, a processor, and a webpage address deduplication system stored on the memory and operable on the processor, the webpage
  • the address deduplication system is implemented by the processor to implement the following steps:
  • the pending webpage address is stopped from being stored in the queue to be crawled.
  • the flag bit includes a first value and a second value
  • the data structure of the current node includes a pointer initialization operation and a first constructor, and the first constructor does not pass the specified parameter in the new node object of the current node.
  • the data field property of the newly created node object is set to the specified character.
  • the data structure of the current node includes a pointer initialization operation and a second constructor, and the second constructor specifies the new node object of the current node.
  • the data value is assigned to the data field of the newly created node object.
  • the inserting the to-be-processed webpage address into the improved generalized table comprises: dividing the character string corresponding to the to-be-processed webpage address into a single letter, and each node in the improved generalized table stores one letter.
  • the present application further provides a method for de-duplicating a webpage address, the method is applied to an electronic device, and the method includes:
  • the pending webpage address is stopped from being stored in the queue to be crawled.
  • the flag bit includes a first value and a second value
  • the data structure of the current node includes a pointer initialization operation and a first constructor, and the first constructor does not pass the specified parameter in the new node object of the current node.
  • the data field property of the newly created node object is set to the specified character
  • the data structure of the current node includes a pointer initialization operation and a second constructor, and the second constructor assigns the specified data value passed by the new node object of the current node. Give the data field of the newly created node object.
  • the inserting the to-be-processed webpage address into the improved generalized table comprises: dividing the character string corresponding to the to-be-processed webpage address into a single letter, and each node in the improved generalized table stores one letter.
  • the present application further provides a computer readable storage medium storing a webpage address deduplication system, the webpage address deduplication system being executable by at least one processor, The step of causing the at least one processor to perform the web page address deduplication method as described above.
  • the electronic device, the webpage address deduplication method and the computer readable storage medium proposed by the present application use the generalized table based on memory improvement to perform the URL deduplication operation, which is much better than the traditional in time efficiency.
  • URL deduplication scheme there is a high space feasibility in space efficiency, which can maintain the efficient operation of deduplication operations for a long time without obvious bottleneck constraints.
  • 1 is a schematic diagram of an optional hardware architecture of an electronic device of the present application
  • FIG. 2 is a schematic diagram of a program module of an embodiment of a webpage address deduplication system in an electronic device of the present application
  • FIG. 3 is a schematic flowchart of an implementation manner of an embodiment of a method for de-duplicating a webpage address according to the present application.
  • first, second and the like in the present application are for the purpose of description only, and are not to be construed as indicating or implying their relative importance or implicitly indicating the number of technical features indicated. .
  • features defining “first” and “second” may include at least one of the features, either explicitly or implicitly.
  • the technical solutions between the various embodiments may be combined with each other, but must be based on the realization of those skilled in the art, and when the combination of the technical solutions is contradictory or impossible to implement, it should be considered that the combination of the technical solutions does not exist. Nor is it within the scope of protection required by this application.
  • FIG. 1 it is a schematic diagram of an optional hardware architecture of the electronic device 2 of the present application.
  • the electronic device 2 may include, but is not limited to, a memory 21, a processor 22, and a network interface 23 that can communicate with each other through a system bus. It is pointed out that FIG. 1 only shows the electronic device 2 with the components 21-23, but it should be understood that not all illustrated components are required to be implemented, and more or fewer components may be implemented instead.
  • the electronic device 2 may be a computing device such as a rack server, a blade server, a tower server, or a rack server.
  • the electronic device 2 may be an independent server or a server cluster composed of multiple servers. .
  • the memory 21 includes at least one type of readable storage medium including a flash memory, a hard disk, a multimedia card, a card type memory (eg, SD or DX memory, etc.), a random access memory (RAM), a static Random access memory (SRAM), read only memory (ROM), electrically erasable programmable read only memory (EEPROM), programmable read only memory (PROM), magnetic memory, magnetic disk, optical disk, and the like.
  • the memory 21 may be an internal storage unit of the electronic device 2, such as a hard disk or memory of the electronic device 2.
  • the memory 21 may also be an external storage device of the electronic device 2, such as a plug-in hard disk equipped on the electronic device 2, a smart memory card (SMC), and a secure digital device. (Secure Digital, SD) card, flash card, etc.
  • the memory 21 may also include both an internal storage unit of the electronic device 2 and an external storage device thereof.
  • the memory 21 is generally used to store an operating system installed in the electronic device 2 and various types of application software, such as program code of the webpage address deduplication system 20. Further, the memory 21 can also be used to temporarily store various types of data that have been output or are to be output.
  • the processor 22 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data processing chip in some embodiments.
  • the processor 22 is typically used to control the overall operation of the electronic device 2, such as performing control and processing related to data interaction or communication with the electronic device 2.
  • the processor 22 is configured to run program code or process data stored in the memory 21, such as running the webpage address deduplication system 20 and the like.
  • the network interface 23 may comprise a wireless network interface or a wired network interface, which is typically used to establish a communication connection between the electronic device 2 and other electronic devices.
  • the network interface 23 is configured to connect the electronic device 2 to an external data platform through a network, and establish a data transmission channel and a communication connection between the electronic device 2 and an external data platform.
  • the network may be an intranet, an Internet, a Global System of Mobile communication (GSM), a Wideband Code Division Multiple Access (WCDMA), a 4G network, or a 5G network.
  • Wireless or wired networks such as the Internet, Bluetooth, Wi-Fi, etc.
  • FIG. 2 it is a program module diagram of an embodiment of the webpage address deduplication system 20 in the electronic device 2 of the present application.
  • the webpage address deduplication system 20 can be divided into one or more program modules, and the one or more program modules are stored in the memory 21 and are composed of one or more processors. (Processing in the present embodiment for the processor 22) to complete the application.
  • the web page address deduplication system 20 can be divided into a search module 201, an insert module 202, and a deduplication module 203.
  • a program module as referred to in the present application refers to a series of computer program instruction segments capable of performing a specific function, and is more suitable than the program to describe the execution process of the web page address deduplication system 20 in the electronic device 2.
  • the function of each program module 201-203 will be described in detail below.
  • the search module 201 is configured to sequentially read a webpage address (such as a URL address) to be processed, and search for the webpage address to be processed in the improved generalized table.
  • a URL Universal Resource Locator
  • a URL can be sequentially read from the webpage log.
  • the URL deduplication operation is performed by using a generalized table based on memory improvement, and each node (such as a normal node and an element node) in the improved generalized table has the same weight (equivalent position), and the Each node in the improved generalized table adds a flag to determine if the current node is the root node (root node).
  • the flag bit is used to determine a departure node of each dynamic insertion operation.
  • each node has a flag bit (such as an isRoot flag bit) for determining whether the current node is a root node, and the flag bit includes a first value (such as true, representing 1) and a second value (such as false). , representing 0). If it is detected that the flag of the current node is the first value (such as true, representing 1), it is determined that the current node is the root node, and the traversal is started from the current node, and is determined as the starting node of the dynamic insertion operation; if the current node is detected The flag is the second value (such as false, representing 0), then it is determined that the current node is not the root node, and continues to traverse the next node.
  • a flag bit such as an isRoot flag bit
  • the conventional generalized table includes nodes with different weights (ie, nodes with different status), such as ordinary nodes and element nodes. Therefore, it is necessary to judge the type of nodes when performing dynamic addition, deletion, and modification of the generalized table. It takes a lot of time.
  • each node has the same status, so that no additional judgment is required, and the dynamic expansion can be efficiently performed to adapt to the deduplication requirement. More specifically, in this embodiment, by adding one isRoot flag bit in each node, only a little memory space is added to each node, which belongs to a scheme of space swapping time, and the time efficiency is greatly improved.
  • the node data structure setting of the improved generalized table is as follows.
  • a specified data value such as a data parameter data
  • the inserting module 202 is configured to insert the to-be-processed webpage address into the improved generalized table if the unprocessed webpage address is not searched in the improved generalized table, and store the to-be-processed webpage address to be grasped Take the queue and wait in line for the web crawler to crawl the web content.
  • the inserting the to-be-processed webpage address into the improved generalized table comprises: dividing a character string (such as a URL string) corresponding to the to-be-processed webpage address into a single letter, Improve the generalized table to store one letter per node.
  • a character string such as a URL string
  • the de-duplication module 203 is configured to stop storing the to-be-processed webpage address into the to-be-crawled queue if the searched webpage address is searched in the improved generalized table, so as to avoid repeated webpage content capture operations.
  • the webpage address deduplication system 20 proposed by the present application performs URL deduplication operations by using a generalized table based on memory improvement, which is much better in time efficiency than the conventional URL deduplication scheme. Further, there is a high space feasibility in space efficiency, which can maintain the efficient operation of deduplication operations for a long time without obvious bottleneck constraints.
  • the present application also proposes a web address deduplication method.
  • FIG. 3 it is a schematic flowchart of an implementation manner of an embodiment of a webpage address deduplication method of the present application.
  • the order of execution of the steps in the flowchart shown in FIG. 3 may be changed according to different requirements, and some steps may be omitted.
  • Step S31 sequentially reading a to-be-processed webpage address (such as a URL address), and searching for the to-be-processed webpage address in the improved generalized table.
  • a URL Universal Resource Locator
  • a URL can be sequentially read from the webpage log.
  • the URL deduplication operation is performed by using a generalized table based on memory improvement, and each node (such as a normal node and an element node) in the improved generalized table has the same weight (equivalent position), and the Each node in the improved generalized table adds a flag to determine if the current node is the root node (root node).
  • the flag bit is used to determine a departure node of each dynamic insertion operation.
  • each node has a flag bit (such as an isRoot flag bit) for determining whether the current node is a root node, and the flag bit includes a first value (such as true, representing 1) and a second value (such as false). , representing 0). If it is detected that the flag of the current node is the first value (such as true, representing 1), it is determined that the current node is the root node, and the traversal is started from the current node, and is determined as the starting node of the dynamic insertion operation; if the current node is detected The flag is the second value (such as false, representing 0), then it is determined that the current node is not the root node, and continues to traverse the next node.
  • a flag bit such as an isRoot flag bit
  • the conventional generalized table includes nodes with different weights (ie, nodes with different status), such as ordinary nodes and element nodes. Therefore, it is necessary to judge the type of nodes when performing dynamic addition, deletion, and modification of the generalized table. It takes a lot of time.
  • the improved generalized table in this embodiment has the same status for each node, so that no additional judgment is required, and dynamic expansion can be efficiently performed to adapt to the demand for deduplication. More specifically, in this embodiment, by adding one isRoot flag bit in each node, only a little memory space is added to each node, which belongs to a scheme of space swapping time, and the time efficiency is greatly improved.
  • the node data structure setting of the improved generalized table is as follows.
  • a specified data value such as a data parameter data
  • Step S32 if the to-be-processed webpage address is not searched in the improved generalized table, insert the to-be-processed webpage address into the improved generalized table, and store the to-be-processed webpage address into the to-be-crawled queue, and wait in line.
  • Web crawlers perform crawling of web content.
  • the inserting the to-be-processed webpage address into the improved generalized table comprises: dividing a character string (such as a URL string) corresponding to the to-be-processed webpage address into a single letter, Improve the generalized table to store one letter per node.
  • a character string such as a URL string
  • step S33 if the address of the to-be-processed webpage is searched in the improved generalized table, the webpage address to be processed is stopped from being stored in the queue to be crawled, thereby avoiding repeated webpage content capture operations.
  • the webpage address deduplication method proposed by the present application performs the URL deduplication operation by adopting the generalized table based on memory improvement, which is much better in time efficiency than the traditional URL deduplication scheme. Further, there is a high space feasibility in space efficiency, which can maintain the efficient operation of deduplication operations for a long time without obvious bottleneck constraints.
  • the present application further provides a computer readable storage medium (such as a ROM/RAM, a magnetic disk, an optical disk), where the computer readable storage medium stores a webpage address deduplication system 20, the webpage
  • the address deduplication system 20 can be executed by at least one processor 22 to cause the at least one processor 22 to perform the steps of the web page address deduplication method as described above.
  • the foregoing embodiment method can be implemented by means of software plus a necessary general hardware platform, and can also be implemented by hardware, but in many cases, the former is A better implementation.
  • the technical solution of the present application which is essential or contributes to the prior art, may be embodied in the form of a software product stored in a storage medium (such as ROM/RAM, disk,
  • the optical disc includes a number of instructions for causing a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the methods described in various embodiments of the present application.

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

一种网页地址去重方法,该方法包括步骤:依次读取一条待处理网页地址(如URL地址),于改进广义表中搜索该待处理网页地址(S31);若所述改进广义表中没有搜索到该待处理网页地址,则将该待处理网页地址***至所述改进广义表,并将该待处理网页地址存入待抓取队列(S32);若所述改进广义表中搜索到该待处理网页地址,则停止将该待处理网页地址存入待抓取队列(S33)。通过上述方法可以提升网页地址去重效率。

Description

网页地址去重方法、电子设备及计算机可读存储介质
本申请要求于2017年10月13日提交中国专利局、申请号为201710954304.5、发明名称为“网页地址去重方法、电子设备及计算机可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在申请中。
技术领域
本申请涉及计算机信息技术领域,尤其涉及一种网页地址去重方法、电子设备及计算机可读存储介质。
背景技术
目前,网络爬虫常用的URL去重方案有基于数据库的去重方案和基于内存链表的去重方案,这些方案在URL库容量不大的情况下有不错的效果。但是,现有的分布式爬虫面向的URL库容量通常非常大,需要URL去重能够持久保持高效运作,而上述常用的URL去重方案在爬虫程序运行较长时间后会有效率剧降或任务瘫痪的风险。故,现有技术中的URL去重方法设计不够合理,亟需改进。
发明内容
有鉴于此,本申请提出一种网页地址去重方法、电子设备及计算机可读存储介质,通过采用基于内存改进的广义表进行URL去重作业,在时间效率上大大优于传统的URL去重方案。
首先,为实现上述目的,本申请提出一种电子设备,所述电子设备包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的网页地址去重***,所述网页地址去重***被所述处理器执行时实现如下步骤:
依次读取一条待处理网页地址,于改进广义表中搜索该待处理网页地址, 其中,所述改进广义表中的每个节点权重相同,且所述改进广义表中的每个节点包括一个判断当前节点是否为根节点的标志位;
若所述改进广义表中没有搜索到该待处理网页地址,则将该待处理网页地址***至所述改进广义表,并将该待处理网页地址存入待抓取队列;及
若所述改进广义表中搜索到该待处理网页地址,则停止将该待处理网页地址存入待抓取队列。
优选地,所述标志位包括第一数值和第二数值;
如果检测到当前节点的标志位为第一数值,则确定该当前节点为根节点,从该当前节点开始遍历,确定为动态***操作的出发节点;及
如果检测到当前节点的标志位为第二数值,则确定该当前节点不是根节点,继续遍历下一个节点。
优选地,若所述改进广义表的当前节点为根节点,则该当前节点的数据结构包括指针初始化操作和第一构造函数,该第一构造函数在该当前节点的新建节点对象没有传递指定参数时,默认将该新建节点对象的数据域属性设置为指定字符。
优选地,若所述改进广义表的当前节点为非根节点,则该当前节点的数据结构包括指针初始化操作和第二构造函数,该第二构造函数将该当前节点的新建节点对象传递的指定数据值赋值给该新建节点对象的数据域。
优选地,所述将该待处理网页地址***至所述改进广义表包括:将该待处理网页地址对应的字符串分割为单个的字母,所述改进广义表中每个节点存储一个字母。
此外,为实现上述目的,本申请还提供一种网页地址去重方法,该方法应用于电子设备,所述方法包括:
依次读取一条待处理网页地址,于改进广义表中搜索该待处理网页地址,其中,所述改进广义表中的每个节点权重相同,且所述改进广义表中的每个 节点包括一个判断当前节点是否为根节点的标志位;
若所述改进广义表中没有搜索到该待处理网页地址,则将该待处理网页地址***至所述改进广义表,并将该待处理网页地址存入待抓取队列;及
若所述改进广义表中搜索到该待处理网页地址,则停止将该待处理网页地址存入待抓取队列。
优选地,所述标志位包括第一数值和第二数值;
如果检测到当前节点的标志位为第一数值,则确定该当前节点为根节点,从该当前节点开始遍历,确定为动态***操作的出发节点;及
如果检测到当前节点的标志位为第二数值,则确定该当前节点不是根节点,继续遍历下一个节点。
优选地,若所述改进广义表的当前节点为根节点,则该当前节点的数据结构包括指针初始化操作和第一构造函数,该第一构造函数在该当前节点的新建节点对象没有传递指定参数时,默认将该新建节点对象的数据域属性设置为指定字符;及
若所述改进广义表的当前节点为非根节点,则该当前节点的数据结构包括指针初始化操作和第二构造函数,该第二构造函数将该当前节点的新建节点对象传递的指定数据值赋值给该新建节点对象的数据域。
优选地,所述将该待处理网页地址***至所述改进广义表包括:将该待处理网页地址对应的字符串分割为单个的字母,所述改进广义表中每个节点存储一个字母。
进一步地,为实现上述目的,本申请还提供一种计算机可读存储介质,所述计算机可读存储介质存储有网页地址去重***,所述网页地址去重***可被至少一个处理器执行,以使所述至少一个处理器执行如上述的网页地址去重方法的步骤。
相较于现有技术,本申请所提出的电子设备、网页地址去重方法及计算机可读存储介质,通过采用基于内存改进的广义表进行URL去重作业,在时间效率上大大优于传统的URL去重方案。进一步地,在空间效率上有很高的空间可行性,能够持久保持去重作业的高效运作,没有明显的瓶颈制约。
附图说明
图1是本申请电子设备一可选的硬件架构的示意图;
图2是本申请电子设备中网页地址去重***一实施例的程序模块示意图;
图3为本申请网页地址去重方法一实施例的实施流程示意图。
附图标记:
电子设备 2
存储器 21
处理器 22
网络接口 23
网页地址去重*** 20
搜索模块 201
***模块 202
去重模块 203
流程步骤 S31-S33
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
具体实施方式
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施 例仅用以解释本申请,并不用于限定本申请。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
需要说明的是,在本申请中涉及“第一”、“第二”等的描述仅用于描述目的,而不能理解为指示或暗示其相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括至少一个该特征。另外,各个实施例之间的技术方案可以相互结合,但是必须是以本领域普通技术人员能够实现为基础,当技术方案的结合出现相互矛盾或无法实现时应当认为这种技术方案的结合不存在,也不在本申请要求的保护范围之内。
进一步需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。
首先,本申请提出一种电子设备2。
参阅图1所示,是本申请电子设备2一可选的硬件架构的示意图。本实施例中,所述电子设备2可包括,但不限于,可通过***总线相互通信连接存储器21、处理器22、网络接口23。需要指出的是,图1仅示出了具有组件21-23的电子设备2,但是应理解的是,并不要求实施所有示出的组件,可以替代的实施更多或者更少的组件。
其中,所述电子设备2可以是机架式服务器、刀片式服务器、塔式服务器或机柜式服务器等计算设备,该电子设备2可以是独立的服务器,也可以是多个服务器所组成的服务器集群。
所述存储器21至少包括一种类型的可读存储介质,所述可读存储介质包括闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、随机访问存储器(RAM)、静态随机访问存储器(SRAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、可编程只读存储器(PROM)、磁性存储器、磁盘、光盘等。在一些实施例中,所述存储器21可以是所述电子设备2的内部存储单元,例如该电子设备2的硬盘或内存。在另一些实施例中,所述存储器21也可以是所述电子设备2的外部存储设备,例如该电子设备2上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。当然,所述存储器21还可以既包括所述电子设备2的内部存储单元也包括其外部存储设备。本实施例中,所述存储器21通常用于存储安装于所述电子设备2的操作***和各类应用软件,例如所述网页地址去重***20的程序代码等。此外,所述存储器21还可以用于暂时地存储已经输出或者将要输出的各类数据。
所述处理器22在一些实施例中可以是中央处理器(Central Processing Unit,CPU)、控制器、微控制器、微处理器、或其他数据处理芯片。该处理器22通常用于控制所述电子设备2的总体操作,例如执行与所述电子设备2进行数据交互或者通信相关的控制和处理等。本实施例中,所述处理器22用于运行所述存储器21中存储的程序代码或者处理数据,例如运行所述的网页地址去重***20等。
所述网络接口23可包括无线网络接口或有线网络接口,该网络接口23通常用于在所述电子设备2与其他电子设备之间建立通信连接。例如,所述网络接口23用于通过网络将所述电子设备2与外部数据平台相连,在所述电子设备2与外部数据平台之间的建立数据传输通道和通信连接。所述网络可以是企业内部网(Intranet)、互联网(Internet)、全球移动通讯***(Global System of Mobile communication,GSM)、宽带码分多址(Wideband Code Division Multiple Access,WCDMA)、4G网络、5G网络、蓝牙(Bluetooth)、 Wi-Fi等无线或有线网络。
至此,己经详细介绍了本申请各个实施例的应用环境和相关设备的硬件结构和功能。下面,将基于上述应用环境和相关设备,提出本申请的各个实施例。
参阅图2所示,是本申请电子设备2中网页地址去重***20一实施例的程序模块图。本实施例中,所述的网页地址去重***20可以被分割成一个或多个程序模块,所述一个或者多个程序模块被存储于所述存储器21中,并由一个或多个处理器(本实施例中为所述处理器22)所执行,以完成本申请。例如,在图2中,所述的网页地址去重***20可以被分割成搜索模块201、***模块202、以及去重模块203。本申请所称的程序模块是指能够完成特定功能的一系列计算机程序指令段,比程序更适合于描述所述网页地址去重***20在所述电子设备2中的执行过程。以下将就各程序模块201-203的功能进行详细描述。
所述搜索模块201,用于依次读取一条待处理网页地址(如URL地址),于改进广义表中搜索该待处理网页地址。其中,在本实施例中,可以从网页日志中依次读取一条URL(Universal Resource Locator,统一资源定位符)。
优选地,在本实施例中,采用基于内存改进的广义表进行URL去重作业,所述改进广义表中的每个节点(如普通节点和元素节点)权重相同(地位相等),且所述改进广义表中的每个节点增加一个判断当前节点是否为根节点(root节点)的标志位。其中,所述标志位用于确定每次动态***操作的出发节点。
在本实施例中,每个节点都有判断当前节点是否为根节点的标志位(如isRoot标志位),所述标志位包括第一数值(如true,代表1)和第二数值(如false,代表0)。如果检测到当前节点的标志位为第一数值(如true,代表1),则确定该当前节点为根节点,从该当前节点开始遍历,确定为动态***操作 的出发节点;如果检测到当前节点的标志位为第二数值(如false,代表0),则确定该当前节点不是根节点,继续遍历下一个节点。
需要说明的是,传统的广义表包含不同权重的节点(即地位不同的节点),如普通节点和元素节点,因此,在进行广义表的动态增加、删除和修改时需要判断节点的类型,会耗费较多时间。本实施例中改进后的广义表每个节点地位相等,因此无需额外的判断,能够高效地进行动态扩展,适应去重的需求。更具体而言,本实施例通过在每个节点中增加一个isRoot标志位,仅在每个节点增加了一点内存空间,属于空间换时间的一种方案,在时间效率上有大幅提高。
举例而言,在本实施例中,所述改进广义表的节点数据结构设置如下所示。
Figure PCTCN2018076170-appb-000001
Figure PCTCN2018076170-appb-000002
在本实施例中,若所述改进广义表的当前节点为根节点(isRoot=true),则该当前节点的数据结构包括,但不限于,指针初始化操作(head=tail=null)和第一构造函数(this.data='?'),该第一构造函数在该当前节点的新建节点对象(如GLNode对象)没有传递指定参数时,默认将该新建节点对象的数据域属性(即data属性)设置为指定字符'?'。若所述改进广义表的当前节点为非根节点(isRoot=false),则该当前节点的数据结构包括,但不限于,指针初始化操作(head=tail=null)和第二构造函数(this.data=data),该第二构造函数将该当前节点的新建节点对象(如GLNode对象)传递的指定数据值(如数据参数data)赋值给该新建节点对象的数据域。
所述***模块202,用于若所述改进广义表中没有搜索到该待处理网页地址,则将该待处理网页地址***至所述改进广义表,并将该待处理网页地址存入待抓取队列,排队等待网络爬虫进行网页内容的抓取作业。
优选地,在本实施例中,所述将该待处理网页地址***至所述改进广义表包括:将该待处理网页地址对应的字符串(如URL字符串)分割为单个的字母,所述改进广义表中每个节点存储一个字母。
所述去重模块203,用于若所述改进广义表中搜索到该待处理网页地址,则停止将该待处理网页地址存入待抓取队列,避免重复进行网页内容抓取作业。
通过上述程序模块201-203,本申请所提出的网页地址去重***20,通过 采用基于内存改进的广义表进行URL去重作业,在时间效率上大大优于传统的URL去重方案。进一步地,在空间效率上有很高的空间可行性,能够持久保持去重作业的高效运作,没有明显的瓶颈制约。
此外,本申请还提出一种网页地址去重方法。
参阅图3所示,是本申请网页地址去重方法一实施例的实施流程示意图。在本实施例中,根据不同的需求,图3所示的流程图中的步骤的执行顺序可以改变,某些步骤可以省略。
步骤S31,依次读取一条待处理网页地址(如URL地址),于改进广义表中搜索该待处理网页地址。其中,在本实施例中,可以从网页日志中依次读取一条URL(Universal Resource Locator,统一资源定位符)。
优选地,在本实施例中,采用基于内存改进的广义表进行URL去重作业,所述改进广义表中的每个节点(如普通节点和元素节点)权重相同(地位相等),且所述改进广义表中的每个节点增加一个判断当前节点是否为根节点(root节点)的标志位。其中,所述标志位用于确定每次动态***操作的出发节点。
在本实施例中,每个节点都有判断当前节点是否为根节点的标志位(如isRoot标志位),所述标志位包括第一数值(如true,代表1)和第二数值(如false,代表0)。如果检测到当前节点的标志位为第一数值(如true,代表1),则确定该当前节点为根节点,从该当前节点开始遍历,确定为动态***操作的出发节点;如果检测到当前节点的标志位为第二数值(如false,代表0),则确定该当前节点不是根节点,继续遍历下一个节点。
需要说明的是,传统的广义表包含不同权重的节点(即地位不同的节点),如普通节点和元素节点,因此,在进行广义表的动态增加、删除和修改时需要判断节点的类型,会耗费较多时间。本实施例中改进后的广义表每个节点地位相等,因此无需额外的判断,能够高效地进行动态扩展,适应去重的需 求。更具体而言,本实施例通过在每个节点中增加一个isRoot标志位,仅在每个节点增加了一点内存空间,属于空间换时间的一种方案,在时间效率上有大幅提高。
举例而言,在本实施例中,所述改进广义表的节点数据结构设置如下所示。
Figure PCTCN2018076170-appb-000003
在本实施例中,若所述改进广义表的当前节点为根节点(isRoot=true),则该当前节点的数据结构包括,但不限于,指针初始化操作(head=tail=null) 和第一构造函数(this.data='?'),该第一构造函数在该当前节点的新建节点对象(如GLNode对象)没有传递指定参数时,默认将该新建节点对象的数据域属性(即data属性)设置为指定字符'?'。若所述改进广义表的当前节点为非根节点(isRoot=false),则该当前节点的数据结构包括,但不限于,指针初始化操作(head=tail=null)和第二构造函数(this.data=data),该第二构造函数将该当前节点的新建节点对象(如GLNode对象)传递的指定数据值(如数据参数data)赋值给该新建节点对象的数据域。
步骤S32,若所述改进广义表中没有搜索到该待处理网页地址,则将该待处理网页地址***至所述改进广义表,并将该待处理网页地址存入待抓取队列,排队等待网络爬虫进行网页内容的抓取作业。
优选地,在本实施例中,所述将该待处理网页地址***至所述改进广义表包括:将该待处理网页地址对应的字符串(如URL字符串)分割为单个的字母,所述改进广义表中每个节点存储一个字母。
步骤S33,若所述改进广义表中搜索到该待处理网页地址,则停止将该待处理网页地址存入待抓取队列,避免重复进行网页内容抓取作业。
通过上述步骤S31-S33,本申请所提出的网页地址去重方法,通过采用基于内存改进的广义表进行URL去重作业,在时间效率上大大优于传统的URL去重方案。进一步地,在空间效率上有很高的空间可行性,能够持久保持去重作业的高效运作,没有明显的瓶颈制约。
进一步地,为实现上述目的,本申请还提供一种计算机可读存储介质(如ROM/RAM、磁碟、光盘),所述计算机可读存储介质存储有网页地址去重***20,所述网页地址去重***20可被至少一个处理器22执行,以使所述至少 一个处理器22执行如上所述的网页地址去重方法的步骤。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件来实现,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本申请各个实施例所述的方法。
以上参照附图说明了本申请的优选实施例,并非因此局限本申请的权利范围。上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。另外,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。
本领域技术人员不脱离本申请的范围和实质,可以有多种变型方案实现本申请,比如作为一个实施例的特征可用于另一实施例而得到又一实施例。凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。

Claims (20)

  1. 一种电子设备,其特征在于,所述电子设备包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的网页地址去重***,所述网页地址去重***被所述处理器执行时实现如下步骤:
    依次读取一条待处理网页地址,于改进广义表中搜索该待处理网页地址,其中,所述改进广义表中的每个节点权重相同,且所述改进广义表中的每个节点包括一个判断当前节点是否为根节点的标志位;
    若所述改进广义表中没有搜索到该待处理网页地址,则将该待处理网页地址***至所述改进广义表,并将该待处理网页地址存入待抓取队列;及
    若所述改进广义表中搜索到该待处理网页地址,则停止将该待处理网页地址存入待抓取队列。
  2. 如权利要求1所述的电子设备,其特征在于,所述标志位包括第一数值和第二数值;
    如果检测到当前节点的标志位为第一数值,则确定该当前节点为根节点,从该当前节点开始遍历,确定为动态***操作的出发节点;及
    如果检测到当前节点的标志位为第二数值,则确定该当前节点不是根节点,继续遍历下一个节点。
  3. 如权利要求2所述的电子设备,其特征在于,若所述改进广义表的当前节点为根节点,则该当前节点的数据结构包括指针初始化操作和第一构造函数,该第一构造函数在该当前节点的新建节点对象没有传递指定参数时,默认将该新建节点对象的数据域属性设置为指定字符。
  4. 如权利要求2所述的电子设备,其特征在于,若所述改进广义表的当 前节点为非根节点,则该当前节点的数据结构包括指针初始化操作和第二构造函数,该第二构造函数将该当前节点的新建节点对象传递的指定数据值赋值给该新建节点对象的数据域。
  5. 如权利要求3所述的电子设备,其特征在于,若所述改进广义表的当前节点为非根节点,则该当前节点的数据结构包括指针初始化操作和第二构造函数,该第二构造函数将该当前节点的新建节点对象传递的指定数据值赋值给该新建节点对象的数据域。
  6. 如权利要求2或3所述的电子设备,其特征在于,所述将该待处理网页地址***至所述改进广义表包括:将该待处理网页地址对应的字符串分割为单个的字母,所述改进广义表中每个节点存储一个字母。
  7. 如权利要求4或5所述的电子设备,其特征在于,所述将该待处理网页地址***至所述改进广义表包括:将该待处理网页地址对应的字符串分割为单个的字母,所述改进广义表中每个节点存储一个字母。
  8. 一种网页地址去重方法,应用于电子设备,其特征在于,所述方法包括:
    依次读取一条待处理网页地址,于改进广义表中搜索该待处理网页地址,其中,所述改进广义表中的每个节点权重相同,且所述改进广义表中的每个节点包括一个判断当前节点是否为根节点的标志位;
    若所述改进广义表中没有搜索到该待处理网页地址,则将该待处理网页地址***至所述改进广义表,并将该待处理网页地址存入待抓取队列;及
    若所述改进广义表中搜索到该待处理网页地址,则停止将该待处理网页地址存入待抓取队列。
  9. 如权利要求8所述的网页地址去重方法,其特征在于,所述标志位包括第一数值和第二数值;
    如果检测到当前节点的标志位为第一数值,则确定该当前节点为根节点,从该当前节点开始遍历,确定为动态***操作的出发节点;及
    如果检测到当前节点的标志位为第二数值,则确定该当前节点不是根节点,继续遍历下一个节点。
  10. 如权利要求9所述的网页地址去重方法,其特征在于,若所述改进广义表的当前节点为根节点,则该当前节点的数据结构包括指针初始化操作和第一构造函数,该第一构造函数在该当前节点的新建节点对象没有传递指定参数时,默认将该新建节点对象的数据域属性设置为指定字符。
  11. 如权利要求9所述的网页地址去重方法,其特征在于,若所述改进广义表的当前节点为非根节点,则该当前节点的数据结构包括指针初始化操作和第二构造函数,该第二构造函数将该当前节点的新建节点对象传递的指定数据值赋值给该新建节点对象的数据域。
  12. 如权利要求10所述的网页地址去重方法,其特征在于,若所述改进广义表的当前节点为非根节点,则该当前节点的数据结构包括指针初始化操作和第二构造函数,该第二构造函数将该当前节点的新建节点对象传递的指定数据值赋值给该新建节点对象的数据域。
  13. 如权利要求9或10所述的网页地址去重方法,其特征在于,所述将该待处理网页地址***至所述改进广义表包括:将该待处理网页地址对应的字符串分割为单个的字母,所述改进广义表中每个节点存储一个字母。
  14. 如权利要求11或12所述的网页地址去重方法,其特征在于,所述将该待处理网页地址***至所述改进广义表包括:将该待处理网页地址对应的字符串分割为单个的字母,所述改进广义表中每个节点存储一个字母。
  15. 一种计算机可读存储介质,所述计算机可读存储介质存储有网页地址去重***,所述网页地址去重***可被至少一个处理器执行,所述网页地址去重***被所述处理器执行时实现如下步骤:
    依次读取一条待处理网页地址,于改进广义表中搜索该待处理网页地址,其中,所述改进广义表中的每个节点权重相同,且所述改进广义表中的每个节点包括一个判断当前节点是否为根节点的标志位;
    若所述改进广义表中没有搜索到该待处理网页地址,则将该待处理网页地址***至所述改进广义表,并将该待处理网页地址存入待抓取队列;及
    若所述改进广义表中搜索到该待处理网页地址,则停止将该待处理网页地址存入待抓取队列。
  16. 如权利要求15所述的计算机可读存储介质,其特征在于,所述标志位包括第一数值和第二数值;
    如果检测到当前节点的标志位为第一数值,则确定该当前节点为根节点,从该当前节点开始遍历,确定为动态***操作的出发节点;及
    如果检测到当前节点的标志位为第二数值,则确定该当前节点不是根节点,继续遍历下一个节点。
  17. 如权利要求16所述的计算机可读存储介质,其特征在于,若所述改进广义表的当前节点为根节点,则该当前节点的数据结构包括指针初始化操作和第一构造函数,该第一构造函数在该当前节点的新建节点对象没有传递 指定参数时,默认将该新建节点对象的数据域属性设置为指定字符。
  18. 如权利要求16或17所述的计算机可读存储介质,其特征在于,若所述改进广义表的当前节点为非根节点,则该当前节点的数据结构包括指针初始化操作和第二构造函数,该第二构造函数将该当前节点的新建节点对象传递的指定数据值赋值给该新建节点对象的数据域。
  19. 如权利要求16或17所述的计算机可读存储介质,其特征在于,所述将该待处理网页地址***至所述改进广义表包括:将该待处理网页地址对应的字符串分割为单个的字母,所述改进广义表中每个节点存储一个字母。
  20. 如权利要求18所述的计算机可读存储介质,其特征在于,所述将该待处理网页地址***至所述改进广义表包括:将该待处理网页地址对应的字符串分割为单个的字母,所述改进广义表中每个节点存储一个字母。
PCT/CN2018/076170 2017-10-13 2018-02-10 网页地址去重方法、电子设备及计算机可读存储介质 WO2019071896A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710954304.5 2017-10-13
CN201710954304.5A CN107844527A (zh) 2017-10-13 2017-10-13 网页地址去重方法、电子设备及计算机可读存储介质

Publications (1)

Publication Number Publication Date
WO2019071896A1 true WO2019071896A1 (zh) 2019-04-18

Family

ID=61661333

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/076170 WO2019071896A1 (zh) 2017-10-13 2018-02-10 网页地址去重方法、电子设备及计算机可读存储介质

Country Status (2)

Country Link
CN (1) CN107844527A (zh)
WO (1) WO2019071896A1 (zh)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108985759B (zh) * 2018-06-15 2020-10-23 杭州复杂美科技有限公司 一种加密货币的地址生成方法及***、设备和存储介质
CN109657118A (zh) * 2018-11-21 2019-04-19 安徽云融信息技术有限公司 一种分布式网络爬虫的url去重方法及其***
CN110134768B (zh) * 2019-05-13 2023-05-26 腾讯科技(深圳)有限公司 文本的处理方法、装置、设备及存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101458740A (zh) * 2008-12-25 2009-06-17 东华大学 基于3-臂dna分子的dna计算机广义表数据结构设计方法
CN101620608A (zh) * 2008-07-04 2010-01-06 全国组织机构代码管理中心 信息采集方法及***
CN102184227A (zh) * 2011-05-10 2011-09-14 北京邮电大学 一种面向web服务的通用爬虫引擎***及其工作方法
US20120023112A1 (en) * 2010-07-20 2012-01-26 Barracuda Networks Inc. Method for measuring similarity of diverse binary objects comprising bit patterns

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101778041B (zh) * 2009-12-31 2012-07-18 福建星网锐捷网络有限公司 路径选择方法、装置和网络设备
US9058392B1 (en) * 2012-03-22 2015-06-16 Google Inc. Client state result de-duping
CN103631839B (zh) * 2013-06-27 2017-08-29 西南科技大学 一种页面地域权重模型实现方法
CN104809182B (zh) * 2015-04-17 2016-08-17 东南大学 基于动态可***Bloom Filter的网络爬虫URL去重方法
CN104809190B (zh) * 2015-04-21 2018-07-31 浙江大学 一种树形结构数据的数据库存取方法
CN107038179B (zh) * 2016-08-23 2020-04-10 平安科技(深圳)有限公司 信息项存储方法和***

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101620608A (zh) * 2008-07-04 2010-01-06 全国组织机构代码管理中心 信息采集方法及***
CN101458740A (zh) * 2008-12-25 2009-06-17 东华大学 基于3-臂dna分子的dna计算机广义表数据结构设计方法
US20120023112A1 (en) * 2010-07-20 2012-01-26 Barracuda Networks Inc. Method for measuring similarity of diverse binary objects comprising bit patterns
CN102184227A (zh) * 2011-05-10 2011-09-14 北京邮电大学 一种面向web服务的通用爬虫引擎***及其工作方法

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
WU, XIAOHUI: "Improvement on Unrepeated Tactics of URL of Distributed Spider", JOURNAL OF PINGDINGSHAN UNIVERSITY, vol. 24, no. 5, 31 October 2009 (2009-10-31), pages 116, XP055591924, ISSN: 1673-1670 *

Also Published As

Publication number Publication date
CN107844527A (zh) 2018-03-27

Similar Documents

Publication Publication Date Title
US10394792B1 (en) Data storage in a graph processing system
WO2019085471A1 (zh) 数据库同步方法、应用服务器及计算机可读存储介质
TWI549060B (zh) Access methods and devices for virtual machine data
WO2019085334A1 (zh) 分布式存储方法、控制服务器及计算机可读存储介质
WO2017201977A1 (zh) 一种数据写、读方法、装置及分布式对象存储集群
US11003625B2 (en) Method and apparatus for operating on file
WO2019148722A1 (zh) 电子装置、数据迁移及调用方法及存储介质
WO2019134339A1 (zh) 脱敏方法、程序、应用服务器及计算机可读存储介质
WO2019061991A1 (zh) 多元通用模型平台建模方法、电子设备及计算机可读存储介质
WO2019153603A1 (zh) 网页爬取的配置方法、应用服务器及计算机可读存储介质
CN111400308A (zh) 缓存数据的处理方法、电子装置及可读存储介质
US20160283479A1 (en) Method and system for manipulating data
WO2019075968A1 (zh) 表格信息跨页识别方法、电子设备及计算机可读存储介质
WO2019071896A1 (zh) 网页地址去重方法、电子设备及计算机可读存储介质
CN105677904B (zh) 基于分布式文件***的小文件存储方法及装置
CN109976669B (zh) 一种边缘存储方法、装置和存储介质
WO2019169764A1 (zh) 电子装置、数据链式归档的方法、***及存储介质
WO2019041524A1 (zh) 聚类标签生成方法、电子设备及计算机可读存储介质
WO2017032170A1 (zh) 镜像文件的导入方法及装置
WO2019095667A1 (zh) 数据库数据采集方法、应用服务器及计算机可读存储介质
CN112416972A (zh) 实时数据流处理方法、装置、设备、及可读存储介质
CN110352410B (zh) 跟踪索引节点的访问模式以及预提取索引节点
WO2019071958A1 (zh) 基于云计算的薪资计算方法、应用服务器及计算机可读存储介质
CN109542860B (zh) 基于hdfs的业务数据管理方法、终端设备
WO2019041525A1 (zh) 同名实体识别方法、电子设备及计算机可读存储介质

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS (EPO FORM 1205A DATED 30.09.2020)

122 Ep: pct application non-entry in european phase

Ref document number: 18865387

Country of ref document: EP

Kind code of ref document: A1