Method, device and electronic device for generating advertisement filtering rules
Through automated tools, obtaining and analyzing web page images and generating advertising filtering rules, solving the problems of inefficient and insufficient accuracy of existing advertising filtering solutions, and achieving more efficient and accurate advertising filtering effects.
Patent Information
- Application Number
- CN202111258403.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-27
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2041-10-27
AI Technical Summary
Existing advertising filtering solutions rely on manual writing rules, are inefficient and difficult to guarantee.
The images of multiple web pages are obtained through automated tools, the ad location is determined using image recognition, and the advertising operation instructions are triggered to obtain element node information, and the advertisement filtering rules are generated based on the number of advertisements and element node information.
Improve the efficiency and accuracy of advertising filtering rules generation, and achieve more accurate web ad blocking effects.
Smart Images

Figure CN113971237B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to big data and browser technology in the field of artificial intelligence technology, and in particular to a method, device and electronic device for generating advertisement filtering rules. Background Art
[0002] When users browse the web, advertisements on the web greatly affect the user's browsing experience. Therefore, most browsers have added advertisement filtering functions to block advertisements on the web that do not meet the specifications and affect the user's browsing experience.
[0003] The open source version of the AdblockPlus plug-in is the current mainstream ad filtering solution, which mainly filters resources or element nodes with ad features through resource-based rules and element-based rules. However, the filtering rules mainly rely on manual summary output, which is inefficient and difficult to guarantee accuracy. Summary of the invention
[0004] The present disclosure provides a method, device and electronic device for generating advertisement filtering rules with improved efficiency and accuracy.
[0005] According to one aspect of the present disclosure, a method for generating an advertisement filtering rule is provided, comprising:
[0006] Obtain at least one image corresponding to each of the multiple web pages;
[0007] Determine location information of an advertisement in each web page according to at least one picture corresponding to each web page;
[0008] triggering an operation instruction for the advertisement according to the location information, and acquiring information of an element node corresponding to the advertisement based on the operation instruction;
[0009] Advertisement filtering rules are generated according to the number of times the advertisement appears in multiple web pages and information of element nodes corresponding to the advertisement.
[0010] According to another aspect of the present disclosure, a device for generating advertisement filtering rules is provided, comprising:
[0011] An acquisition module, used to acquire at least one image corresponding to each of the plurality of web pages;
[0012] A determination module, configured to determine location information of advertisements in each web page according to at least one picture corresponding to each web page;
[0013] A trigger module, configured to trigger an operation instruction for the advertisement according to the location information, and obtain information of an element node corresponding to the advertisement based on the operation instruction;
[0014] The generating module is used to generate advertisement filtering rules according to the number of times the advertisement appears in a plurality of web pages and the information of the element nodes corresponding to the advertisement.
[0015] According to another aspect of the present disclosure, there is provided an electronic device, comprising:
[0016] at least one processor; and
[0017] a memory communicatively connected to the at least one processor; wherein,
[0018] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method described in the first aspect above.
[0019] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the method described in the first aspect.
[0020] According to another aspect of the present disclosure, a computer program product is provided, the program product comprising: a computer program, the computer program being stored in a readable storage medium, at least one processor of an electronic device being able to read the computer program from the readable storage medium, and the at least one processor executing the computer program so that the electronic device executes the method described in the first aspect.
[0021] According to the technical solution of the present disclosure, the efficiency and accuracy of generating advertisement filtering rules are improved.
[0022] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0024] Figure 1 is a flowchart of a method for generating advertisement filtering rules according to an embodiment of the present disclosure;
[0025] Figure 2 is a schematic diagram of advertisement detection provided according to an embodiment of the present disclosure;
[0026] Figure 3 It is a structural schematic diagram of a device for generating advertisement filtering rules according to an embodiment of the present disclosure;
[0027] Figure 4It is a schematic block diagram of an electronic device used to implement the method for generating advertisement filtering rules according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0028] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0029] Regarding the filtering rules in the ad filtering function, the current mainstream practice in the industry is to rely on experienced engineers to manually write them. New rule updates generally go through the stages of ad discovery, rule analysis and refinement, review, and release. These processes rely on manual output, are time-consuming, and accuracy cannot be guaranteed.
[0030] To this end, the present invention proposes a method for automatically generating advertising filtering rules, which uses an automated tool to control a browser to access multiple web pages and take screenshots, then performs image recognition on the screenshots to confirm the advertisements therein, and then automatically triggers the advertisements to obtain the element nodes corresponding to the advertisements in the browser kernel, determines the advertising filtering rules based on the number of advertisement appearances and the information of the element nodes, and realizes the automatic generation of advertising filtering rules.
[0031] The present invention discloses a method, device and electronic device for generating advertisement filtering rules, which are applied to the fields of big data in the field of artificial intelligence technology and browser technology, and can be specifically applied to advertisement filtering in browsers, so as to improve the efficiency and accuracy of rule generation and the effect of shielding advertisements on web pages.
[0032] The following will describe in detail the method for generating advertisement filtering rules provided by the present disclosure through specific embodiments. It is understandable that the following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0033] Figure 1 1 is a flow chart of a method for generating advertisement filtering rules according to an embodiment of the present disclosure. The method is performed by a device for generating advertisement filtering rules, which can be implemented by software and / or hardware. Figure 1 As shown, the method includes:
[0034] S101: Obtain at least one picture corresponding to each of a plurality of web pages.
[0035] Multiple web pages are web pages for detecting advertisements, which can be determined according to actual conditions. For example, the multiple web pages can cover web pages of mainstream video, novel, news and information websites. In order to realize the automatic generation of advertisement filtering rules, an automation tool, such as an automation script, can be used to control the browser to access the URLs corresponding to each of the multiple web pages, and to take a screenshot of each web page to obtain the corresponding pictures of each web page. Due to the different sizes of web pages, some web pages may not be fully displayed in one page and need to be slid or dragged to browse. Therefore, after controlling the browser to access the web page, it is also possible to control the dragging or sliding of the page, take multiple screenshots, and obtain multiple pictures corresponding to the web page.
[0036] S102: Determine location information of an advertisement in each web page according to at least one picture corresponding to each web page.
[0037] For each image, an advertisement detection model may be used for detection. The image is input into the advertisement detection model, and the detection result may indicate whether there is an advertisement in the image. If there is an advertisement, the detection result includes the location information of the advertisement.
[0038] For example, Figure 2 As shown in the figure, the dotted box marks the location of the detected advertisement. The detection result can include the coordinates of the midpoint of the advertisement. Where (x1, y1) is the coordinate of the upper left corner of the ad, and (x2, y2) is the coordinate of the lower right corner of the ad.
[0039] The advertisement detection model may be pre-trained in advance, for example, by collecting screenshots of web pages, marking the locations of advertisements, and training with the YOLO algorithm to obtain an advertisement detection model capable of identifying the locations of advertisements on web pages.
[0040] S103: triggering an operation instruction for the advertisement according to the location information, and acquiring information of an element node corresponding to the advertisement based on the operation instruction.
[0041] After determining the location information of an advertisement in a web page, the location information can be used to trigger operation instructions for the advertisement using automated tools, i.e., simulating clicking on the advertisement. After clicking on the advertisement, the click callback is listened to in the browser kernel to obtain the information of the element node corresponding to the clicked advertisement, i.e., to determine which element node in the web page is the element node representing the advertisement.
[0042] S104: Generate advertisement filtering rules according to the number of times the advertisement appears in multiple web pages and information about element nodes of the advertisement.
[0043] By simulating clicking on an advertisement, the information of the element node of the advertisement is obtained, and then the advertisement filtering rules can be generated based on the information of the element node of the advertisement, so as to shield the element node representing the advertisement. At the same time, in actual scenarios, some advertisements may appear frequently in various web pages of different websites, and some advertisements may only appear in some specific web pages. Therefore, when generating advertisement filtering rules, the number of appearances of the advertisement in multiple web pages can be combined. Comprehensive filtering can be achieved for frequently appearing advertisements, and precise filtering can also be achieved for occasionally appearing advertisements, thereby improving processing efficiency while ensuring filtering accuracy.
[0044] In the method of the embodiment of the present disclosure, a web page is automatically accessed and a screenshot is taken, the image obtained by the screenshot is detected, the location of the advertisement therein is identified, thereby triggering a click on the advertisement, and the information of the element node corresponding to the advertisement is obtained by monitoring the click callback, and the advertisement filtering rules are generated in combination with the number of times the advertisement appears in multiple web pages, thereby realizing the automatic generation of advertisement filtering rules, improving the efficiency and accuracy of the advertisement filtering rules, and further improving the web page advertisement shielding effect.
[0045] Based on the above embodiment, how to generate advertisement filtering rules according to the number of times advertisements appear in multiple web pages and the information of element nodes corresponding to the advertisements is described.
[0046] Optionally, the identification information of the element node is determined according to the information of the element node corresponding to the advertisement; the type of the advertisement filtering rule is determined according to the number of times the advertisement appears in multiple web pages; and the advertisement filtering rule is generated according to the identification information and type of the element node.
[0047] The information of the element node corresponding to the advertisement may include the attributes of the element node corresponding to the advertisement, such as tag, id, class, nth-child, src, href, z-index and other attributes, and may also include information such as the parent node of the element node. This information is used to determine the identification information of the element node, and the element node corresponding to the advertisement is distinguished from other element nodes for easy filtering.
[0048] For example, according to the information of the element node, the path information from the root node of the element node to the element node is determined; and the path information is determined as the identification information of the element node.
[0049] One or more of the attributes of the element node are used to form a path identifier of the element node, and the element node is distinguished from its sibling nodes. The same method is then used to form a path identifier of the parent node using one or more of the attributes of the element node's parent node, and the parent node is distinguished from its sibling nodes. This process is continued upward until the root node is found, thereby obtaining path information from the root node to the element node. The path information includes the path identifiers from the root node to each node in the element node. The path information is used as the identification information of the element node, so that the element node can be distinguished from any other element node in the web page.
[0050] For example, #app>.publicAllContentBg>.bigBannerBg represents the child node of class=bigBannerBg of the child node of class=publicAllContentBg of the node with id=app. An advertisement element node can be uniquely identified through the path information, so that advertisement filtering rules can be determined based on it to achieve accurate filtering.
[0051] Optionally, after detecting advertisements in multiple web pages, the type of advertisement filtering rules is determined to be a general type (General element hiding rules) or a special type (Specific element hiding rules) according to the number of times the advertisements appear in the multiple web pages. For example, if some advertisements frequently appear in various web pages of different websites, the type of the advertisement filtering rules corresponding to them is determined to be a general type, so as to perform comprehensive filtering on various websites; if some advertisements only appear in some specific web pages, the type of the advertisement filtering rules corresponding to them is determined to be a special type, so as to perform precise surface filtering only on specific websites.
[0052] Optionally, if the type of the advertisement filtering rule is a general rule, the advertisement filtering rule is generated according to the identification information of the element node, and the general rule is a rule applied to all domain names.
[0053] For example, the advertisement filtering rule is in the form of: ###googleAdIndexTop, where #googleAdIndexTop is the identification information of the element node, and the advertisement filtering rule is applied to all domain names.
[0054] Optionally, if the type is a general rule, the first domain name information is obtained, and an exclusion domain is generated based on the first domain name information. The general rule is a rule applied to other domain names except the exclusion domain; an advertisement filtering rule is generated based on the exclusion domain and element node information.
[0055] For example, the advertisement filtering rule is in the form of: ~xxxxedu.com###haoetv, wherein the first domain name information xxxxedu.com marked by ~ is an excluded domain, and #haoetv is the identification information of the element node. The advertisement filtering rule does not filter the domain name xxxxedu.com, but filters all other domain names except xxxxedu.com.
[0056] From the above, we can see that a general rule can be divided into two parts: exclusion domain and filtering rule. The filtering rule part is the identification information of the element node, and for the general rule applied to all domain names, it can be regarded as that its exclusion domain is empty, and the general rule is used to filter all other domain names except the exclusion domain. Thus, comprehensive filtering of web page advertisements can be achieved.
[0057] Optionally, if the type is a special rule, the second domain name information is obtained, and an effective domain is generated according to the second domain name information, and the special rule is a rule applied to the effective domain; an advertisement filtering rule is generated according to the effective domain and element node information.
[0058] Special rules can also become special site rules. For example, the advertising filtering rule is in the form of: enjoymore.fun##a[href="urlto.pw"], wherein the second domain name information enjoymore.fun is the effective domain, a[href="urlto.pw"] is the identification information of the element node, and the special rule only filters the effective domain enjoymore.fun; for example, the advertising filtering rule is in the form of: xxx.com##a[href="wan.xxx.com / "], wherein the second domain name information xxx.com is the effective domain, a[href="wan.xxx.com / "] is the identification information of the element node, and the special rule only filters the effective domain xxx.com.
[0059] From the above, we can see that a special rule can be divided into two parts: effective domain and filtering rule. The filtering rule part is the identification information of the element node, and the special rule only filters the domain name in the effective domain. Therefore, accurate filtering of web page advertisements can be achieved.
[0060] By generating advertisement filtering rules through the above method and using the CSS selector to locate the advertisement elements, the web page advertisements can be filtered, thus improving the advertisement filtering effect.
[0061] On the basis of the above embodiment, in order to ensure the accuracy of the advertisement filtering rules, the advertisement filtering rules can be adjusted by verifying the filtering effect of the advertisement filtering rules. Optionally, similar to generating advertisement rules, each web page is accessed and screenshots are taken using an automated tool, and an advertisement detection model is used to determine whether there are still advertisements therein, determine the filtering effect, and update the advertisement filtering rules according to the filtering effect.
[0062] In addition to the filtering effect, it is also possible to verify the false positives of the advertising filtering rules, that is, the situation where non-advertising elements are mistakenly filtered. Optionally, when loading a web page, filter the advertisements in the web page according to the advertising filtering rules; obtain the advertising filtering log, and determine whether the non-advertising elements are filtered based on the advertising filtering log; if the non-advertising elements are filtered, update the advertising filtering rules based on the filtered non-advertising elements.
[0063] Optionally, the advertising filtering rules can be comprehensively updated according to the filtering effect and the false positive situation to ensure the effectiveness and feasibility of the advertising filtering rules. For advertising filtering rules that meet the filtering effect and the false positive situation, for example, the filtering effect is greater than the first threshold and the false positive is less than the second threshold, they can be applied as formal outputs to achieve rapid updating of advertising filtering rules and ensure the filtering effect of web ads.
[0064] Figure 3 is a schematic diagram of the structure of a device for generating advertisement filtering rules according to an embodiment of the present disclosure. Figure 3 As shown, the advertisement filtering rule generating device 300 includes:
[0065] An acquisition module 301 is used to acquire at least one image corresponding to each of the plurality of web pages;
[0066] A determination module 302, configured to determine location information of advertisements in each web page according to at least one picture corresponding to each web page;
[0067] The trigger module 303 is used to trigger an operation instruction for the advertisement according to the location information, and obtain information of the element node corresponding to the advertisement based on the operation instruction;
[0068] The generating module 304 is used to generate advertisement filtering rules according to the number of times the advertisement appears in the multiple web pages and the information of the element nodes corresponding to the advertisement.
[0069] In one implementation, the generating module 304 includes:
[0070] A first determining unit, configured to determine identification information of an element node according to information of the element node corresponding to the advertisement;
[0071] A second determination unit, configured to determine a type of advertisement filtering rule according to the number of times the advertisement appears in the plurality of web pages;
[0072] The generating unit is used to generate advertisement filtering rules according to the identification information and type of the element node.
[0073] In one implementation, the first determining unit includes:
[0074] A first determining subunit, configured to determine path information from a root node of the element node to the element node according to information of the element node;
[0075] The second determining subunit is used to determine the path information as identification information of the element node.
[0076] In one implementation, the generating unit includes:
[0077] A first generating subunit is used for obtaining first domain name information if the type is a general rule, and generating an exclusion domain according to the first domain name information, wherein the general rule is a rule applied to other domain names except the exclusion domain;
[0078] The second generating subunit is used to generate advertisement filtering rules according to the exclusion domain and element node information.
[0079] In one implementation, the generating unit includes:
[0080] The third generating subunit is used to generate advertisement filtering rules according to the identification information of the element node if the type is a general rule, and the general rule is a rule applicable to all domain names.
[0081] In one implementation, the generating unit includes:
[0082] The fourth generating subunit is used for obtaining the second domain name information if the type is a special rule, and generating an effective domain according to the second domain name information, wherein the special rule is a rule applied to the effective domain;
[0083] The fifth generating subunit is used to generate advertisement filtering rules according to the effective domain and element node information.
[0084] In one implementation, the advertisement filtering rule generating device 300 further includes:
[0085] A filtering module is used to filter advertisements in a web page according to advertisement filtering rules when the web page is loaded;
[0086] A judgment module, used to obtain an advertisement filtering log and determine whether non-advertisement elements are filtered out according to the advertisement filtering log;
[0087] The updating module is used to update the advertisement filtering rules according to the filtered non-advertisement elements if the non-advertisement elements are filtered.
[0088] The device of the embodiment of the present disclosure can be used to execute the method for generating advertisement filtering rules in the above method embodiment. Its implementation principle and technical effect are similar and will not be described in detail here.
[0089] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device and a non-transitory computer-readable storage medium storing computer instructions.
[0090] According to an embodiment of the present disclosure, the present disclosure also provides a computer program product, the program product includes: a computer program, the computer program is stored in a readable storage medium, at least one processor of an electronic device can read the computer program from the readable storage medium, and at least one processor executes the computer program so that the electronic device executes the solution provided by any of the above embodiments.
[0091] Figure 4 Schematic block diagram of an electronic device for implementing the method for generating advertisement filtering rules of an embodiment of the present disclosure. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0092] like Figure 4 As shown, the electronic device 400 includes a computing unit 401, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 402 or a computer program loaded from a storage unit 408 into a random access memory (RAM) 403. In the RAM 403, various programs and data required for the operation of the device 400 can also be stored. The computing unit 401, the ROM 402, and the RAM 403 are connected to each other via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.
[0093] A number of components in the device 400 are connected to the I / O interface 405, including: an input unit 406, such as a keyboard, a mouse, etc.; an output unit 407, such as various types of displays, speakers, etc.; a storage unit 408, such as a disk, an optical disk, etc.; and a communication unit 409, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 409 allows the device 400 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0094] The computing unit 401 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 401 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 401 performs the various methods and processes described above, such as the method for generating advertising filtering rules. For example, in some embodiments, the method for generating advertising filtering rules may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 408. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 400 via the ROM 402 and / or the communication unit 409. When the computer program is loaded into the RAM 403 and executed by the computing unit 401, one or more steps of the method for generating advertising filtering rules described above may be performed. Alternatively, in other embodiments, the computing unit 401 may be configured to perform the method for generating advertising filtering rules in any other appropriate manner (e.g., by means of firmware).
[0095] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0096] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0097] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0098] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0099] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0100] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server of a distributed system, or a server combined with a blockchain.
[0101] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this application can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution disclosed in this disclosure can be achieved, and this document is not limited here.
[0102] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A method for generating advertisement filtering rules, comprising: Automatically access multiple web pages and take screenshots of each web page to obtain at least one picture corresponding to each of the multiple web pages; Determine location information of an advertisement in each web page according to at least one picture corresponding to each web page; triggering an operation instruction for the advertisement according to the location information, and acquiring information of an element node corresponding to the advertisement based on the operation instruction; Generate an advertisement filtering rule according to the number of times the advertisement appears in the plurality of web pages and information of the element nodes corresponding to the advertisement; The generating of advertisement filtering rules according to the number of times the advertisement appears in the plurality of web pages and the information of the element nodes corresponding to the advertisement comprises: Determining identification information of the element node according to information of the element node corresponding to the advertisement; Determining the type of the advertisement filtering rule according to the number of times the advertisement appears in the plurality of web pages, wherein the type of the advertisement filtering rule includes a general rule and a special rule, the general rule is comprehensive filtering, and the special rule is precise filtering; Generate an advertisement filtering rule according to the identification information and the type of the element node; The determining, according to information of the element node corresponding to the advertisement, identification information of the element node includes: Determine, according to the information of the element node, path information from the root node of the element node to the element node; The path information is determined as identification information of the element node.
2. The method according to claim 1, wherein: The generating of advertisement filtering rules according to the identification information and the type of the element node includes: If the type is a general rule, obtaining first domain name information, and generating an exclusion domain according to the first domain name information, wherein the general rule is a rule applied to other domain names except the exclusion domain; The advertisement filtering rule is generated according to the exclusion domain and the element node information.
3. The method according to claim 1, wherein: The generating of advertisement filtering rules according to the identification information and the type of the element node includes: If the type is a general rule, an advertisement filtering rule is generated according to the identification information of the element node, and the general rule is a rule applicable to all domain names.
4. The method according to claim 1, wherein: The generating of advertisement filtering rules according to the identification information and the type of the element node includes: If the type is a special rule, obtaining the second domain name information, and generating an effective domain according to the second domain name information, wherein the special rule is a rule applied to the effective domain; The advertisement filtering rule is generated according to the effective domain and the element node information.
5. The method according to claim 1, further comprising: When loading a web page, filtering advertisements in the web page according to the advertisement filtering rule; Obtaining an advertisement filtering log, and determining whether non-advertisement elements are filtered out according to the advertisement filtering log; If non-advertisement elements are filtered, the advertisement filtering rules are updated according to the filtered non-advertisement elements.
6. A device for generating advertisement filtering rules, comprising: An acquisition module, used for automatically accessing a plurality of web pages and taking a screenshot of each web page to acquire at least one picture corresponding to each of the plurality of web pages; A determination module, configured to determine location information of advertisements in each web page according to at least one picture corresponding to each web page; A trigger module, configured to trigger an operation instruction for the advertisement according to the location information, and obtain information of an element node corresponding to the advertisement based on the operation instruction; A generating module, used for generating advertisement filtering rules according to the number of appearances of the advertisement in a plurality of web pages and information of element nodes corresponding to the advertisement; Wherein, the generation module includes: A first determining unit, configured to determine identification information of the element node according to information of the element node corresponding to the advertisement; a second determining unit, configured to determine the type of the advertisement filtering rule according to the number of times the advertisement appears in the plurality of web pages, wherein the type of the advertisement filtering rule includes a general rule and a special rule, the general rule is comprehensive filtering, and the special rule is precise filtering; A generating unit, configured to generate an advertisement filtering rule according to the identification information of the element node and the type; The first determining unit includes: A first determining subunit, configured to determine path information from a root node of the element node to the element node according to information of the element node; The second determining subunit is used to determine the path information as identification information of the element node.
7. The device according to claim 6, wherein: The generating unit comprises: a first generating subunit, configured to obtain first domain name information if the type is a general rule, and generate an exclusion domain according to the first domain name information, wherein the general rule is a rule applied to other domain names except the exclusion domain; The second generating subunit is used to generate the advertisement filtering rule according to the exclusion domain and the element node information.
8. The device according to claim 6, wherein: The generating unit comprises: The third generating subunit is used to generate advertisement filtering rules according to the identification information of the element node if the type is a general rule, and the general rule is a rule applicable to all domain names.
9. The device according to claim 6, wherein: The generating unit comprises: a fourth generating subunit, configured to obtain second domain name information if the type is a special rule, and generate an effective domain according to the second domain name information, wherein the special rule is a rule applied to the effective domain; The fifth generating subunit is used to generate the advertisement filtering rule according to the effective domain and the element node information.
10. The apparatus according to claim 6, further comprising: A filtering module, used for filtering advertisements in a web page according to the advertisement filtering rules when the web page is loaded; A judgment module, used to obtain an advertisement filtering log, and determine whether non-advertisement elements are filtered according to the advertisement filtering log; An updating module is configured to update the advertisement filtering rules according to the filtered non-advertisement elements if the non-advertisement elements are filtered.
11. An electronic device, comprising: at least one processor; and a memory communicatively coupled to the at least one processor; The memory stores instructions that can be executed by at least one processor, and the instructions are executed by at least one processor so that the at least one processor can execute the method described in any one of claims 1 to 5.
12. A non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 5.
13. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Web page advertisement filtering method and device
CN106326316A
Advertisement filtering rule generation method based on machine learning and advertisement filtering system
CN108733764A
Method for generating advertisement recognition model, advertisement recognition method and system
CN109241437A
Cited By
WeChat official account advertisement detection method and system
CN122335375A