CN108846061B - Method, device and terminal equipment for shielding advertisement - Google Patents

Method, device and terminal equipment for shielding advertisement Download PDF

Info

Publication number
CN108846061B
CN108846061B CN201810561444.0A CN201810561444A CN108846061B CN 108846061 B CN108846061 B CN 108846061B CN 201810561444 A CN201810561444 A CN 201810561444A CN 108846061 B CN108846061 B CN 108846061B
Authority
CN
China
Prior art keywords
advertisement
page
attribute
elements
loaded
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN201810561444.0A
Other languages
Chinese (zh)
Other versions
CN108846061A (en
Inventor
徐德明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Kingsoft Cloud Network Technology Co Ltd
Beijing Kingsoft Cloud Technology Co Ltd
Original Assignee
Beijing Kingsoft Cloud Network Technology Co Ltd
Beijing Kingsoft Cloud Technology Co Ltd
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 Beijing Kingsoft Cloud Network Technology Co Ltd, Beijing Kingsoft Cloud Technology Co Ltd filed Critical Beijing Kingsoft Cloud Network Technology Co Ltd
Priority to CN201810561444.0A priority Critical patent/CN108846061B/en
Publication of CN108846061A publication Critical patent/CN108846061A/en
Application granted granted Critical
Publication of CN108846061B publication Critical patent/CN108846061B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention provides a method, a device and terminal equipment for shielding advertisements; wherein, the method comprises the following steps: acquiring a stacking sequence identifier of each element in the page to be loaded from the page data of the page to be loaded, wherein the stacking sequence identifier is used for representing the stacking sequence of each element; judging whether the stacking sequence identifier meets a preset identifier range or not; if yes, determining the element corresponding to the stacking sequence identifier as an advertisement element; and shielding the advertisement elements. The invention can improve the advertisement shielding effect, thereby improving the user experience.

Description

Method, device and terminal equipment for shielding advertisement
Technical Field
The invention relates to the field of internet, in particular to a method, a device and terminal equipment for shielding advertisements.
Background
With the popularization and development of the internet, more and more companies choose to put advertisements on websites to improve the popularity or promote product sales; limited by the display area, the advertisement window may block the website content, and may cause the user to click the advertisement by mistake, which causes a certain trouble for the user to use the website normally.
In view of that part of users are not interested in advertisements, in order to improve user experience, certain means can be adopted to shield off advertisements on websites; the current common method is to analyze the web page content of the current web page, identify the elements belonging to the advertisement part according to the category identification, ID identification and the like of each element in the web page content, and shield the advertisement elements in the display process; however, in order to avoid advertisement being shielded, a dynamic way is increasingly adopted to allocate category identifiers and ID identifiers to elements in a website, which disables the advertisement shielding way, and the effect of shielding advertisements is poor, thereby affecting the experience of users.
Disclosure of Invention
In view of this, an object of the embodiments of the present invention is to provide a method, an apparatus, and a terminal device for shielding an advertisement, so as to improve an advertisement shielding effect, thereby improving user experience.
In order to achieve the above purpose, the embodiment of the present invention adopts the following technical solutions:
in a first aspect, an embodiment of the present invention provides a method for shielding an advertisement, where the method is applied to a terminal device, and the method includes: determining advertisement elements in the page to be loaded according to the stacking sequence of the elements in the page to be loaded; the advertisement element is masked.
In a preferred embodiment of the present invention, the step of determining the advertisement elements in the page to be loaded according to the stacking sequence of the elements in the page to be loaded includes: acquiring stacking sequence identifiers of elements in the page to be loaded from page data of the page to be loaded; the stacking sequence identification is used for representing the stacking sequence of each element; judging whether the stacking sequence identifier meets a preset identifier range or not; if so, the element corresponding to the stacking order identifier is determined to be an advertisement element.
In a preferred embodiment of the present invention, the step of masking the advertisement element includes: adding advertisement elements to a preset group; the advertisement elements in the packet are hidden.
In a preferred embodiment of the present invention, the step of hiding the advertisement elements in the packet includes: traversing advertisement elements in the groups in a circulating mode; the display attributes of the advertisement elements are set to be hidden one by one.
In a preferred embodiment of the present invention, after the step of determining the advertisement elements in the page to be loaded, the method further includes: acquiring first element attributes of elements except the determined advertisement elements from page data of a page to be loaded; judging whether the attribute value of the first element attribute contains first specified content or not; if so, determining the element corresponding to the first element attribute as the advertisement element.
In a preferred embodiment of the present invention, the first element attribute includes at least one of a keyword of a DOM node, an ID identifier of the DOM node, a keyword of a parent node, and an ID identifier of the parent node; the first designation includes "ad-".
In a preferred embodiment of the present invention, the method further includes: acquiring a second element attribute of the advertisement elements in the group from page data of the page to be loaded; judging whether the attribute value of the second element attribute contains second specified content or not; if yes, determining the advertisement elements as non-advertisement elements, and removing the advertisement elements from the grouping.
In a second aspect, an embodiment of the present invention provides an apparatus for shielding an advertisement, where the apparatus is disposed in a terminal device, and the apparatus includes: the determining module is used for determining the advertisement elements in the page to be loaded according to the stacking sequence of the elements in the page to be loaded; and the shielding module is used for shielding the advertisement elements.
In a preferred embodiment of the present invention, the determining module includes:
the first attribute acquisition module is used for acquiring stacking sequence identifiers of elements in the page to be loaded from the page data of the page to be loaded; the stacking sequence identification is used for representing the stacking sequence of each element;
the first element determining module is used for judging whether the stacking sequence identifier meets a preset identifier range or not; if so, the element corresponding to the stacking order identifier is determined to be an advertisement element.
In a preferred embodiment of the present invention, the shielding module is further configured to: adding advertisement elements to a preset group; the advertisement elements in the packet are hidden.
In a preferred embodiment of the present invention, the shielding module is further configured to: traversing advertisement elements in the groups in a circulating mode; the display attributes of the advertisement elements are set to be hidden one by one.
In a preferred embodiment of the present invention, the apparatus further comprises:
the second attribute acquisition module is used for acquiring the first element attribute of each element except the determined advertisement element from the page data of the page to be loaded;
the first judging module is used for judging whether the attribute value of the first element attribute contains first specified content or not;
and the second element determining module is used for determining the element corresponding to the first element attribute as the advertisement element if the attribute value of the first element attribute contains the first specified content.
In a preferred embodiment of the present invention, the first element attribute includes at least one of a keyword of a DOM node, an ID identifier of the DOM node, a keyword of a parent node, and an ID identifier of the parent node; the first designation includes "ad-".
In a preferred embodiment of the present invention, the apparatus further comprises:
the third attribute acquisition module is used for acquiring the second element attribute of the advertisement elements in the group from the page data of the page to be loaded;
the second judging module is used for judging whether the attribute value of the second element attribute contains second specified content;
and the element removing module is used for determining the advertisement elements as non-advertisement elements and removing the advertisement elements from the groups if the attribute values of the second element attributes contain second specified contents.
In a third aspect, an embodiment of the present invention provides a terminal device, where the terminal device includes a memory and a processor, the memory is used to store a program that supports the processor to execute the foregoing method for blocking advertisements, and the processor is configured to execute the program stored in the memory.
In a fourth aspect, an embodiment of the present invention provides a computer storage medium for storing computer software instructions for the apparatus for screening advertisements.
Compared with the prior art, the method, the device, the terminal device and the computer storage medium for shielding the advertisement provided by the embodiment of the invention determine the advertisement elements in the page to be loaded according to the stacking sequence of the elements in the page to be loaded, and further shield the advertisement elements. According to the method, the advertisement elements are determined according to the stacking sequence of the elements, so that the advertisement elements can be effectively identified and shielded even under the condition that the webpage elements are defined by dynamic identification, the advertisement shielding effect is improved, and the user experience is improved.
In order to make the aforementioned and other objects, features and advantages of the present invention comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
FIG. 1 is a flow chart of a method for blocking advertisements according to an embodiment of the present invention;
FIG. 2 is a flow chart of another method for blocking advertisements provided by embodiments of the present invention;
FIG. 3 is a flow chart of another method for masking advertisements provided by embodiments of the present invention;
FIG. 4 is a flow chart of another method for masking advertisements provided by embodiments of the present invention;
FIG. 5 is a flow chart of another method for masking advertisements provided by embodiments of the present invention;
FIG. 6 is a flow chart of another method for masking advertisements provided by embodiments of the present invention;
FIG. 7 is a schematic structural diagram of an apparatus for shielding advertisements according to an embodiment of the present invention;
FIG. 8 is a schematic structural diagram of another advertisement screening device provided by an embodiment of the present invention;
FIG. 9 is a schematic structural diagram of another advertisement screening device provided by an embodiment of the present invention;
fig. 10 is a schematic structural diagram of a terminal device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present invention without making any creative effort, shall fall within the protection scope of the present invention.
Putting an advertisement on a page of a website or an application program, generally writing the advertisement into corresponding page content, and displaying the advertisement as a part of a webpage; in order to shield the advertisement on the web page, it is usually necessary to identify an advertisement element from a plurality of display elements of the web page, and then hide, delete, etc. the identified advertisement element, so that a relatively clean web page can be displayed. In the early web page development process, fixed identifiers are often used to define or describe specific contents, for example, advertisement contents are defined by ads, sound contents are defined by audios, graphics are defined by canvases, etc.; in this case, advertisements may be easily identified and masked from the web page content using a particular tag (e.g., "ad") or tag plus wildcard (e.g., "ad").
To avoid this way of advertisement blocking, the way in which elements in a web page are defined is also changing; in one mode, the Class identification, the ID identification or other related attributes of each element can be dynamically allocated through a specific algorithm, and particularly for an object which is easy to be shielded, such as an advertisement element, the Class identification, the ID identification and the attributes of the advertisement element are often obtained in a random generation mode; for such a web page element definition, the above-mentioned method of shielding advertisements by identifying advertisement element identifications is ineffective, and the more such web pages, the worse the effect of such a method of shielding advertisements.
Based on the above reasons, the embodiments of the present invention provide a method, an apparatus, and a terminal device for shielding an advertisement; the techniques may be applied in browsers, applications, or related security software for managing device security, etc., as described in more detail below.
The inventor finds that, in order to ensure the saliency and the reading amount of the advertisement, the advertisement on the webpage or the application program page is arranged at a position which is relatively ahead of the current page and is not easily blocked by other elements, so that the stacking sequence of the advertisement elements is relatively ahead relative to other elements in the webpage. Based on this commonality, the embodiment of the present invention first provides a method for shielding advertisements, as shown in fig. 1, the method is applied to a terminal device, the terminal device includes a desktop computer, a mobile phone, a tablet computer or other special terminals, etc.; the method comprises the following steps:
step S102, determining advertisement elements in the page to be loaded according to the stacking sequence of the elements in the page to be loaded.
A user can trigger a page loading instruction by inputting a website or clicking a related button, and after receiving the instruction, the terminal loads a page corresponding to the instruction, wherein the page is the page to be loaded; the page data of the page to be loaded comprises page codes and related pictures, audio, video, plug-ins and the like.
Generally, parameters such as sizes, formats, positions, stacking sequences and the like of elements such as characters, pictures, audios, videos and the like are defined in page data of a page to be loaded, so that the elements are reasonably arranged in a limited display area; the element arrangement may be implemented by a specific programming Language, for example, in an HTML (HyperText Markup Language), the stacking order may be set by a z-index statement, and the z-index may be referred to as a stacking order identifier; in other web page programming languages, the stacking order is set by corresponding statements.
The numerical value of the stacking sequence identifier generally corresponds to the stacking sequence of each element one by one; for example, the larger the stacking order flag is, the earlier the stacking order of the elements is, or the smaller the stacking order flag is, the earlier the stacking order of the elements is. Therefore, according to the stacking sequence characteristics of the advertisement elements on a large number of existing webpages, a threshold range of the stacking sequence can be set, so that the advertisement elements can be determined.
Taking HTML language as an example, the larger the stacking sequence identifier is, the more forward the stacking sequence of the elements is; typically, the element default z-index value is 0; the later element, the z-index value may be set to-1; the more advanced element, the z-index value may be set to 1; for the advertisement elements, in order to avoid the advertisement being blocked, webpage developers often set the z-index value of the advertisement elements to be very large, even to reach 10505, which is far beyond the value range of the commonly used z-index. In practical implementation, when the z-index value is greater than a specified value, for example, 100, the element corresponding to the z-index value can be determined as the advertisement element.
Step S104, shielding the advertisement element; and further displaying the page to be loaded after the shielding processing.
For example, the advertisement elements in the page may be specifically masked in the form of deleting and hiding the advertisement elements; if the advertisement elements in the current page are more, the advertisement elements can be deleted or hidden at the same time, and the advertisement elements can be circularly deleted or hidden; when the circulation frequency is higher than the set frequency threshold value, the user can see the effect that all advertisements are completely shielded when watching the webpage.
According to the method for shielding the advertisement, provided by the embodiment of the invention, the advertisement elements in the page to be loaded are determined according to the stacking sequence of the elements in the page to be loaded, and then the advertisement elements are shielded. According to the method, the advertisement elements are determined according to the stacking sequence of the elements, so that the advertisement elements can be effectively identified and shielded even under the condition that the webpage elements are defined by dynamic identification, the advertisement shielding effect is improved, and the user experience is improved.
Another method for shielding advertisements is provided in an embodiment of the present invention, and the method is implemented on the basis of the method shown in fig. 1, in the method, advertisement elements are determined by stacking sequence identifiers, and the stacking sequence identifiers may be used to indicate the stacking sequence of each element; and shielding the advertisement elements in a grouping manner, as shown in fig. 2, the method specifically comprises the following steps:
step S202, page data of the page to be loaded is obtained.
After the page data of the page to be loaded is obtained, the stacking sequence identification of each element in the page to be loaded can be obtained from the page data; in this embodiment, taking a circular traversal form as an example, the stacking sequence identifier of each element is obtained; of course, the stacking sequence identifier of each element on the page data can also be obtained in other sequences or forms.
Step S204, setting the ith element, wherein i is 1, and starting to traverse the elements in the page data; for example, the elements in the page data may be traversed in the order in which the page code was formulated in the page data.
Step S206, acquiring a stacking sequence identifier of the current element; for example, in an HTML page, the stacking order identifier may be the z-index described above.
Step S208, judging whether the stacking sequence identifier of the current element meets a preset identifier range; if yes, go to step S210, and if no, go to step S212.
Specifically, a reasonable identification range may be set according to a programming language of the current page data, and in the case of HTML, for example, a threshold may be set, and when the stacking order identification of the current element is greater than or equal to the threshold, the current element may be determined to be an advertisement element.
In step S210, the element corresponding to the stacking sequence identifier is determined as the advertisement element.
Step S212, judging whether the last element is traversed; if yes, go to step S214; if not, i is i +1, step S206 is executed.
Step S214, adding the advertisement elements into a preset group; for example, an array may be predefined for storing advertisement elements or identifications corresponding to advertisement elements.
Step S216, hide the advertisement elements in the packet.
In practical implementation, the method for shielding advertisements in this embodiment is usually set in the terminal in the form of plug-in and monitoring software, and generally cannot modify the web page code itself, for example, delete advertisement elements in the web page, so the effect of screen advertisements is usually achieved by hiding or filtering the advertisement elements.
And step S218, displaying the processed page to be loaded.
According to the method for shielding the advertisements, the advertisement elements are determined according to the stacking sequence identification of each element in the page to be loaded, and then the advertisement elements are added into the groups to shield the advertisements in a mode of hiding the advertisement elements in the groups. The mode is convenient to operate, and the shielding effect is better, so that the user experience degree is improved.
On the basis of the method shown in fig. 2, the present embodiment also provides another method for shielding an advertisement, where the method further describes a specific way of hiding an advertisement element, as shown in fig. 3, the method includes the following steps:
step S302, page data of a page to be loaded is obtained.
In step S304, the ith element is set, i is 1, and the traversal of the elements in the page data is started.
Step S306, acquiring the stacking sequence identifier of the current element.
Step S308, judging whether the stacking sequence identifier of the current element meets a preset identifier range; if yes, go to step S310, if no, go to step S312.
In step S310, the element corresponding to the stacking sequence identifier is determined as the advertisement element.
Step S312, judging whether the last element is traversed or not; if yes, go to step S314; if not, i is i +1, step S306 is executed.
Step S314, add the above advertisement elements to a preset group.
Step S316, traversing the advertisement elements in the grouping in a circulating mode;
step S318, the display attributes of the advertisement elements are set to be hidden one by one.
For example, the array includes a plurality of advertisement elements, and the display attribute of each advertisement element may be set to be hidden one by one according to the arrangement order. Because the attributes of the elements in the page data cannot be permanently changed through plug-ins or software, the display attributes of the advertisement elements need to be changed circularly and continuously when the current page is in a display state, so that the situation that the advertisement appears and disappears when the advertisement is on the page is avoided, and the advertisement on the page is ensured to be reliably and stably shielded.
And step S320, displaying the processed page to be loaded.
By adding the determined advertisement elements to the groups, the advertisement elements can be directly found out from the groups under the condition of larger page data or more advertisement elements, so that the page data is prevented from being traversed once each time of cyclic hiding, and the operation overhead of the advertisement shielding method can be saved.
Certainly, when the page data is less, the advertisement element may be shielded by continuously and circularly traversing the page data of the page to be loaded, that is, for the HTML page, when it is determined that the z-index of the element is greater than the set threshold, the element is hidden. This mode can also be realized by the following codes:
Figure BDA0001682812820000101
in the above code, the set threshold maxrender of z-index is 5000, forEach is a loop statement, and when the z-index of the current element is greater than the set threshold (i.e. if (zindex > maxrender)), the display attribute of the element is set to be hidden (i.e. item.
When the method for shielding the advertisement is actually applied, because the identification range of the stacking sequence identification is unreasonable, advertisement elements may be missed, so that the advertisement shielding is incomplete, and normal content on a page may be shielded, so that normal display of the page is affected, and the page function is damaged. Based on this, the present embodiment provides another method for shielding advertisements, which mainly alleviates the problem of the above advertisement shielding, as shown in fig. 4, the method includes the following steps:
step S402, acquiring a page to be loaded.
Step S404, determining the advertisement elements in the page to be loaded according to the stacking sequence of the elements in the page to be loaded.
This step S404 may be implemented in the manner shown in fig. 2 or fig. 3, that is, traversing the elements in the page data, and determining whether each element is an advertisement element according to the stacking sequence identifier of the element one by one.
Step S405, acquiring first element attributes of elements except the determined advertisement elements from the page data of the page to be loaded;
in step S406, the ith element is set, i is 1, and traversal of the first element attribute of each acquired element is started.
Step S408, judging whether the attribute value of the first element attribute of the current element contains first specified content; if yes, step S410 is performed, and if no, step S412 is performed.
Wherein, the first element attribute comprises at least one of a keyword of a DOM (Document Object Model) node, an ID of the DOM node, a keyword of a parent node, and an ID of the parent node; the first designation content includes "ad-". The father node is usually the father node of a DOM node; the first element attribute generally includes an attribute name, which may be class, id, or the like, and an attribute value, which is specifically defined by the attribute name.
Taking an HTML webpage as an example, the keyword may be content defined by class, and the class is a keyword of a defined class in C + + language; the ID may identify the content defined by the ID, and generally, a unique ID is set for each class object. The first designated content may be a specific logo (e.g., "ad") or a specific logo plus wildcard (e.g., "ad"). The general syntax of the HTML attributes is as follows: an attribute name N is "attribute value" > content tag name ".
In the HTML web page, each element and thing in the page data is defined as a DOM node, based on which the above step S408 can also be implemented by the following manner:
(1) judging whether the element attribute of each DOM node or the element attribute of the father node of the DOM node in the page data contains' ad-; in actual implementation, the parent node of the current DOM node can be found through the parent () or entries () statements.
(2) If so, determining the DOM node as an advertisement element.
Step S410, determine the element corresponding to the first element attribute as an advertisement element.
Step S412, judging whether the first element attribute of the last element is traversed; if yes, go to step S414; if not, i is i +1, step S408 is performed.
And step S414, shielding the advertisement elements and displaying the page to be loaded after shielding treatment.
In the above manner, on the basis of determining the advertisement elements according to the stacking sequence of each element in the page to be loaded, the advertisement elements in the page data are searched again according to the element attributes, so that the problem of incomplete advertisement shielding caused by determining the advertisement elements by adopting a single stacking sequence can be avoided, and the reliability and effectiveness of advertisement shielding are improved.
Correspondingly, the present embodiment also provides another method for shielding advertisements, which mainly alleviates the above problem of shielding normal content on a page, as shown in fig. 5, the method includes the following steps:
step S502, acquiring page data of a page to be loaded.
In step S504, the ith element is set, i is 1, and traversal of the elements in the page data is started.
In step S506, the stacking order identifier of the current element is obtained.
Step S508, judging whether the stacking sequence identifier of the current element meets a preset identifier range; if yes, go to step S510, if no, go to step S512.
In step S510, the element corresponding to the stacking order identifier is determined as the advertisement element.
Step S512, judging whether the last element is traversed; if yes, go to step S514; if not, i is i +1, step S506 is executed.
Step S514, add the above advertisement elements to a preset group.
Step S515, acquiring a second element attribute of the advertisement element in the group from the page data of the page to be loaded;
the second element attribute generally includes at least one of a keyword of a DOM (Document Object Model) node, an ID of the DOM node, a keyword of a parent node, and an ID of the parent node; however, in actual implementation, the specific contents of the second element attribute and the first element attribute may be the same or different.
In step S516, the jth element is set, j equals 1, and the traversal of the second element attribute of the advertisement element in the packet is started.
Step S518, judging whether the attribute value of the second element attribute of the current advertisement element in the grouping contains second specified content; if so, step S520 is performed, and if not, step S522 is performed.
Step S520, determining the advertisement elements as non-advertisement elements, and removing the advertisement elements from the grouping.
The second specific content is generally a mark for defining other content in the page, and the mark is more fixed and is not generally used for defining advertisements, such as marks for defining pictures, audio and video. If the second element attribute of the ad element or the second element attribute of its parent element contains these identifications, then the ad elements may be considered not to be real ad elements and the feed is removed from the grouping.
Step S522, judging whether the second element attribute of the last advertisement element is traversed; if yes, go to step S524; if not, j equals j +1, go to step S518.
Step S524, hide the advertisement elements in the packet.
Step S526, displaying the processed page to be loaded.
In the above manner, on the basis of determining the advertisement elements according to the stacking sequence of each element in the page to be loaded, the determined advertisement elements are searched again according to the element attributes, and the elements misjudged as the advertisement elements are removed, so that the problem that the normal content on the page is shielded by adopting the stacking sequence is avoided, and the reliability and effectiveness of advertisement shielding are improved.
On the basis of the foregoing embodiments, this embodiment further provides another method for shielding an advertisement, where the method comprehensively determines advertisement elements in multiple ways to further improve the shielding effect of advertisement shielding, as shown in fig. 6, and the method includes the following steps:
step S602, monitoring a page loading instruction of a browser and/or an application program; when the page loading instruction is obtained, obtaining page data of a page to be loaded corresponding to the page loading instruction;
generally, if a browser and an application program are installed in a terminal at the same time, terminal equipment monitors page loading instructions of the browser and the application program at the same time; in addition, the user may also specify to listen to only one of the browser or application. After the terminal acquires the page loading instruction, the subsequent steps of determining advertisement elements and shielding the advertisement elements are further executed; specifically, the page data of the page to be loaded can be processed, so as to identify and shield the advertisement elements.
In step S604, the ith element is set, i is 1, and the traversal of the elements in the page data is started.
Step S606, a stacking order identifier of the current element is obtained.
Step S608, determining whether the stacking sequence identifier of the current element meets a preset identifier range; if so, step S610 is performed, and if not, step S612 is performed.
In step S610, the element corresponding to the stacking order identifier is determined as the advertisement element.
Step S612, judging whether the last element is traversed; if yes, go to step S613; if not, i is i +1, step S606 is performed.
Step S613, obtaining the first element attribute of each element other than the determined advertisement element from the page data of the page to be loaded;
in step S614, the jth element is set, j equals 1, and traversal of the first element attribute of each acquired element is started.
Step S616, determining whether the attribute value of the first element attribute of the current element includes the first designated content; if yes, go to step S618, if no, go to step S620.
In step S618, the element corresponding to the first element attribute is determined as an advertisement element.
Step S620, judging whether the first element attribute of the last element is traversed or not; if yes, go to step S622; if not, j equals j +1, go to step S616.
In step S622, the advertisement elements are added to a preset group.
Step S623, acquiring a second element attribute of the advertisement element in the group from the page data of the page to be loaded;
in step S624, the kth element is set, k is 1, and the traversal of the second element attribute of the advertisement element in the group is started.
Step S626, judging whether the attribute value of the second element attribute of the current advertisement element in the group contains second specified content; if so, step S628 is performed, and if not, step S630 is performed.
In step S628, the advertisement elements are determined to be non-advertisement elements, and the advertisement elements are removed from the grouping.
Step S630, judging whether the second element attribute of the last advertisement element is traversed; if yes, go to step S632; if not, k is k +1, step S626 is performed.
Step S632, traversing the advertisement elements in the grouping in a circulating mode;
in step S634, the display attributes of the advertisement elements are set to be hidden one by one.
And step 636, displaying the processed page to be loaded.
According to the method for shielding the advertisement, the advertisement elements are determined according to the stacking sequence and the element attributes of the elements, the elements which are wrongly judged as the advertisement elements are removed according to the element attributes, the advertisement shielding is accurate, the effect is more stable and reliable, and the user experience degree is higher.
It should be noted that the above method embodiments are all described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments may be referred to each other.
Corresponding to the foregoing method embodiment, an embodiment of the present invention provides an apparatus for shielding an advertisement, where the apparatus is disposed in a terminal device, and as shown in fig. 7, the apparatus includes:
the determining module 71 is configured to determine advertisement elements in the page to be loaded according to the stacking order of the elements in the page to be loaded;
a masking module 72 for masking the advertising element.
The determining module specifically includes:
the first attribute acquisition module is used for acquiring stacking sequence identifiers of elements in the page to be loaded from the page data of the page to be loaded; the stacking sequence identification is used for representing the stacking sequence of each element;
the first element determining module is used for judging whether the stacking sequence identifier meets a preset identifier range or not; if so, the element corresponding to the stacking order identifier is determined to be an advertisement element.
The shielding module is further configured to: adding advertisement elements to a preset group; the advertisement elements in the packet are hidden.
The shielding module is further configured to: traversing advertisement elements in the groups in a circulating mode; the display attributes of the advertisement elements are set to be hidden one by one.
An embodiment of the present invention further provides another apparatus for shielding an advertisement, where the apparatus is disposed in a terminal device, as shown in fig. 8, and on the basis of the apparatus, the apparatus further includes:
a second attribute obtaining module 80, configured to obtain, from the page data of the page to be loaded, a first element attribute of each element other than the determined advertisement element;
a first judging module 81, configured to judge whether an attribute value of the first element attribute includes first specified content;
and the second element determining module 82 is configured to determine, if the attribute value of the first element attribute contains the first specified content, an element corresponding to the first element attribute as an advertisement element.
The first element attribute comprises at least one of a keyword of a DOM node, an ID identification of the DOM node, a keyword of a father node and an ID identification of the father node; the first designation content includes "ad-".
An embodiment of the present invention further provides another apparatus for shielding an advertisement, where the apparatus is disposed in a terminal device, as shown in fig. 9, and on the basis of the apparatus, the apparatus further includes:
a third attribute obtaining module 90, configured to obtain, from the page data of the page to be loaded, a second element attribute of the advertisement element in the group;
a second judging module 91, configured to judge whether the attribute value of the second element attribute includes a second specified content;
and the element removing module 92 is configured to determine that the advertisement element is a non-advertisement element if the attribute value of the second element attribute contains a second specified content, and remove the advertisement element from the group.
The implementation principle and the generated technical effect of the apparatus for shielding advertisement provided by the embodiment of the present invention are the same as those of the foregoing method embodiment, and for the sake of brief description, no mention is made in the apparatus embodiment, and reference may be made to the corresponding contents in the foregoing method embodiment.
The embodiment of the present invention further provides a terminal device, which includes a memory and a processor, where the memory is used to store a program that supports the processor to execute the method for screening advertisements provided in the foregoing embodiment, and the processor is configured to execute the program stored in the memory. The terminal device may also include a communication interface for communicating with other devices or a communication network. The terminal device may be any terminal device including a mobile phone, a tablet computer, a PDA (Personal Digital Assistant), a vehicle-mounted computer, and the like.
Further, the present embodiment also provides a computer storage medium for storing computer software instructions for any apparatus for screening advertisements provided in the foregoing embodiments.
As shown in fig. 10, a schematic structural diagram of a terminal device 100 includes: a Radio Frequency (RF) circuit 110, a memory 120, an input unit 130, a display unit 140, a sensor 150, an audio circuit 160, a Wireless Fidelity (WiFi) module 170, a processor 180, and a power supply 190. Those skilled in the art will appreciate that the terminal device 100 configuration shown in fig. 10 does not constitute a limitation of the terminal device 100 and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
The respective constituent elements of the terminal device 100 will be specifically described below with reference to fig. 10:
the RF circuit 110 may be used for receiving and transmitting signals during information transmission and reception or during a call, and in particular, receives downlink information of a base station and then processes the received downlink information to the processor 180; in addition, the data for designing uplink is transmitted to the base station. In general, the RF circuit 110 includes, but is not limited to, an antenna, at least one Amplifier, a transceiver, a coupler, a Low Noise Amplifier (LNA), a duplexer, and the like. In addition, the RF circuitry 110 may also communicate with networks and other devices via wireless communications. The wireless communication may use any communication standard or protocol, including but not limited to Global System for Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Messaging Service (SMS), and the like.
The memory 120 may be used to store software programs and modules, such as program instructions/modules corresponding to the method for screening advertisements in the embodiment of the present invention, and the processor 180 executes various functional applications and data processing of the terminal device 100, such as the method for screening advertisements provided in the embodiment of the present invention, by executing the software programs and modules stored in the memory 120. The memory 120 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the terminal device 100, and the like. Further, the memory 120 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
The input unit 130 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the terminal device 100. Specifically, the input unit 130 may include a touch panel 131 and other input devices 132. The touch panel 131, also referred to as a touch screen, may collect touch operations of a user on or near the touch panel 131 (e.g., operations of the user on or near the touch panel 131 using any suitable object or accessory such as a finger or a stylus pen), and drive the corresponding connection device according to a preset program. Alternatively, the touch panel 131 may include two parts, i.e., a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 180, and can receive and execute commands sent by the processor 180. In addition, the touch panel 131 may be implemented by various types such as a resistive type, a capacitive type, an infrared ray, and a surface acoustic wave. The input unit 130 may include other input devices 132 in addition to the touch panel 131. In particular, other input devices 132 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like.
The display unit 140 may be used to display information input by the user or information provided to the user and various menus of the terminal device 100. The Display unit 140 may include a Display panel 141, and optionally, the Display panel 141 may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like. Further, the touch panel 131 can cover the display panel 141, and when the touch panel 131 detects a touch operation on or near the touch panel 131, the touch operation is transmitted to the processor 180 to determine the type of the touch event, and then the processor 180 performs processing according to the type of the touch event. Although in fig. 10, the touch panel 131 and the display panel 141 are two separate components to implement the input and output functions of the terminal device 100, in some embodiments, the touch panel 131 and the display panel 141 may be integrated to implement the input and output functions of the terminal device 100.
The terminal device 100 may also include at least one sensor 150, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor that may adjust the brightness of the display panel 141 according to the brightness of ambient light, and a proximity sensor that may turn off the display panel 141 and/or the backlight when the terminal device 100 is moved to the ear. As one of the motion sensors, the accelerometer sensor may detect the magnitude of acceleration in each direction (generally, three axes), detect the magnitude and direction of gravity when stationary, and be used for applications (such as horizontal and vertical screen switching, related games, magnetometer attitude calibration) for recognizing the attitude of the terminal device 100, and related functions (such as pedometer and tapping) for vibration recognition; as for other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, and an infrared sensor, which can be configured in the terminal device 100, detailed descriptions thereof are omitted.
Audio circuitry 160, speaker 161, and microphone 162 may provide an audio interface between a user and terminal device 100. The audio circuit 160 may transmit the electrical signal converted from the received audio data to the speaker 161, and convert the electrical signal into a sound signal for output by the speaker 161; on the other hand, the microphone 162 converts the collected sound signal into an electric signal, converts the electric signal into audio data after being received by the audio circuit 160, and then outputs the audio data to the processor 180 for processing, and then transmits the audio data to, for example, another terminal device 100 via the RF circuit 110, or outputs the audio data to the memory 120 for further processing.
WiFi belongs to a short-distance wireless transmission technology, and the terminal device 100 can help a user send and receive e-mails, browse web pages, access streaming media, and the like through the WiFi module 170, and provides wireless broadband internet access for the user. Although fig. 10 shows the WiFi module 170, it is understood that it does not belong to the essential constitution of the terminal device 100, and may be omitted entirely as needed within the scope not changing the essence of the invention.
The processor 180 is a control center of the terminal device 100, connects various parts of the entire terminal device 100 by various interfaces and lines, and performs various functions of the terminal device 100 and processes data by running or executing software programs and/or modules stored in the memory 120 and calling data stored in the memory 120, thereby performing overall monitoring of the terminal device 100. Alternatively, processor 180 may include one or more processing units; preferably, the processor 180 may integrate an application processor, which mainly handles operating systems, user interfaces, application programs, etc., and a modem processor, which mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 180.
The terminal device 100 further includes a power supply 190 (e.g., a battery) for supplying power to the various components, and preferably, the power supply may be logically connected to the processor 180 via a power management system, so as to manage charging, discharging, and power consumption via the power management system.
It is to be understood that the structure shown in fig. 10 is merely illustrative, and the terminal device 100 may include more or fewer components than shown in fig. 10, or have a different configuration than shown in fig. 10. The components shown in fig. 10 may be implemented in hardware, software, or a combination thereof.
The method, the apparatus, and the computer program product of the terminal device for shielding advertisements provided in the embodiments of the present invention include a computer-readable storage medium storing a program code, where instructions included in the program code may be used to execute the method described in the foregoing method embodiments, and specific implementations may refer to the method embodiments and are not described herein again.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
Finally, it should be noted that: the above-mentioned embodiments are only specific embodiments of the present invention, which are used for illustrating the technical solutions of the present invention and not for limiting the same, and the protection scope of the present invention is not limited thereto, although the present invention is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art can modify or easily conceive the technical solutions described in the foregoing embodiments or equivalent substitutes for some technical features within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the embodiments of the present invention, and they should be construed as being included therein. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims.

Claims (10)

1. A method for shielding advertisements is applied to a terminal device, and comprises the following steps:
acquiring a stacking sequence identifier of each element in a page to be loaded from page data of the page to be loaded, wherein the stacking sequence identifier is used for representing the stacking sequence of each element;
judging whether the stacking sequence identifier meets a preset identifier range or not;
if yes, determining the element corresponding to the stacking sequence identifier as an advertisement element;
masking the advertising element;
the step of masking the advertisement element comprises: adding the advertisement elements to a preset group; hiding advertisement elements in the grouping;
the method further comprises the following steps: acquiring a second element attribute of the advertisement elements in the group from the page data of the page to be loaded;
judging whether the attribute value of the second element attribute contains second specified content or not; wherein the second specified content comprises an identifier defining a picture, audio, or video;
if yes, determining that the advertisement element is a non-advertisement element, and removing the advertisement element from the grouping.
2. The method of claim 1, wherein the step of hiding the advertisement elements in the packet comprises:
and traversing the advertisement elements in the group in a circulating mode, and setting the display attributes of the advertisement elements to be hidden one by one.
3. The method of claim 1, wherein after the step of determining the element corresponding to the stacking order identifier as an advertising element, the method further comprises:
acquiring first element attributes of elements except the advertisement elements from the page data of the page to be loaded;
judging whether the attribute value of the first element attribute contains first specified content or not;
if so, determining the element corresponding to the first element attribute as an advertisement element.
4. The method of claim 3,
the first element attribute comprises at least one of a keyword of a DOM node, an ID identification of the DOM node, a keyword of a father node and an ID identification of the father node;
the first designation content includes "ad-".
5. An apparatus for shielding advertisement, the apparatus being disposed in a terminal device, the apparatus comprising:
the first attribute acquisition module is used for acquiring stacking sequence identifiers of elements in a page to be loaded from page data of the page to be loaded; the stacking sequence identification is used for representing the stacking sequence of each element;
the first element determining module is used for judging whether the stacking sequence identifier meets a preset identifier range, and if so, determining the element corresponding to the stacking sequence identifier as an advertisement element;
a shielding module for shielding the advertisement element;
the shielding module is further configured to: adding the advertisement elements to a preset group; hiding advertisement elements in the grouping;
the device further comprises: a third attribute obtaining module, configured to obtain, from the page data of the page to be loaded, a second element attribute of the advertisement element in the group; the second judging module is used for judging whether the attribute value of the second element attribute contains second specified content; wherein the second specified content comprises an identifier defining a picture, audio, or video; and the element removing module is used for determining the advertisement elements as non-advertisement elements and removing the advertisement elements from the grouping if the attribute values of the second element attributes contain second specified contents.
6. The apparatus of claim 5, wherein the shielding module is further configured to:
traversing the advertisement elements in the group in a circulating mode;
and setting the display attribute of the advertisement elements to be hidden one by one.
7. The apparatus of claim 5, further comprising:
the second attribute acquisition module is used for acquiring the first element attribute of each element except the advertisement element from the page data of the page to be loaded;
the first judging module is used for judging whether the attribute value of the first element attribute contains first specified content or not;
and the second element determining module is used for determining the element corresponding to the first element attribute as the advertisement element if the attribute value of the first element attribute contains first specified content.
8. The apparatus of claim 7,
the first element attribute comprises at least one of a keyword of a DOM node, an ID identification of the DOM node, a keyword of a father node and an ID identification of the father node;
the first designation content includes "ad-".
9. A terminal device, characterized in that the terminal device comprises a memory for storing a program enabling a processor to perform the method of any of claims 1 to 4 and a processor configured to execute the program stored in the memory.
10. A computer storage medium storing computer software instructions for performing the method of any one of claims 1 to 4.
CN201810561444.0A 2018-06-01 2018-06-01 Method, device and terminal equipment for shielding advertisement Active CN108846061B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810561444.0A CN108846061B (en) 2018-06-01 2018-06-01 Method, device and terminal equipment for shielding advertisement

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810561444.0A CN108846061B (en) 2018-06-01 2018-06-01 Method, device and terminal equipment for shielding advertisement

Publications (2)

Publication Number Publication Date
CN108846061A CN108846061A (en) 2018-11-20
CN108846061B true CN108846061B (en) 2022-04-29

Family

ID=64210697

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810561444.0A Active CN108846061B (en) 2018-06-01 2018-06-01 Method, device and terminal equipment for shielding advertisement

Country Status (1)

Country Link
CN (1) CN108846061B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112734501A (en) * 2021-02-05 2021-04-30 上海云鱼智能科技有限公司 Method, device, server, client, terminal and storage medium for judging issued information as advertisement
CN112907304A (en) * 2021-04-09 2021-06-04 厦门理工学院 Method, device, equipment and storage medium for shielding webpage hijacking advertisement

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104239422A (en) * 2014-08-21 2014-12-24 小米科技有限责任公司 Advertisement identification method, advertisement identification device and electronic equipment
CN108062324A (en) * 2016-11-08 2018-05-22 广州市动景计算机科技有限公司 Advertisement filter method, apparatus and user terminal

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105677654B (en) * 2014-11-18 2020-07-03 阿里巴巴(中国)有限公司 Advertisement filtering method and device

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104239422A (en) * 2014-08-21 2014-12-24 小米科技有限责任公司 Advertisement identification method, advertisement identification device and electronic equipment
CN108062324A (en) * 2016-11-08 2018-05-22 广州市动景计算机科技有限公司 Advertisement filter method, apparatus and user terminal

Also Published As

Publication number Publication date
CN108846061A (en) 2018-11-20

Similar Documents

Publication Publication Date Title
CN106708496B (en) Processing method and device for label page in graphical interface
US20170091335A1 (en) Search method, server and client
US20140315584A1 (en) Information recommendation method and apparatus
CN108156508B (en) Barrage information processing method and device, mobile terminal, server and system
CN107145780B (en) Malicious software detection method and device
CN111368290A (en) Data anomaly detection method and device and terminal equipment
CN107766358B (en) Page sharing method and related device
CN109032491B (en) Data processing method and device and mobile terminal
CN108363817B (en) File processing method and device, mobile terminal and computer readable storage medium
CN107766548B (en) Information display method and device, mobile terminal and readable storage medium
CN106951492B (en) File searching method and device and electronic equipment
CN108241703B (en) Webpage data transmission method and device
CN107229618B (en) Method and device for displaying page
WO2015027909A1 (en) Method and apparatus for obtaining hot-topic information
CN110688347A (en) File storage method, file storage device and terminal equipment
CN111078986A (en) Data retrieval method, device and computer readable storage medium
CN108846061B (en) Method, device and terminal equipment for shielding advertisement
KR102239616B1 (en) Message notification method and terminal
WO2015003607A1 (en) Systems and methods for filtering microblogs
CN106844572B (en) Search result processing method and device for search result processing
CN106202422B (en) The treating method and apparatus of Web page icon
CN110633438B (en) News event processing method, terminal, server and storage medium
CN105095161B (en) Method and device for displaying rich text information
CN103823851A (en) Webpage display method and webpage display device
CN111290673B (en) Message processing method and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant