Web page content processing method, device, electronic device and storage medium

By identifying and processing content characters in web page content, drawing them on preset canvas or adding them to tag sets, the problem of low security of web page content is solved, preventing crawlers and improving the content protection effect.

CN114722321BActive Publication Date: 2024-11-12TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110005229.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-01-05
Publication Date
2024-11-12
Estimated Expiration
2041-01-05

AI Technical Summary

Technical Problem

The content of web pages is low in security and is easily crawled by crawlers, because crawlers only need to wait for the content to be loaded to obtain the content on the web page through the script program.

Method used

By identifying the location information of content characters in web page content, determining its processing type, and drawing content characters with the processing type of canvas drawing type on the preset canvas. Content characters with the processing type of label processing type are added to the preset order in the preset order Set the tag set and generate and output the destination web page content to prevent crawlers from crawling.

Benefits of technology

It effectively improves the security of web page content, prevents crawling, and enhances content protection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114722321B_ABST
    Figure CN114722321B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses a web page content processing method, device, electronic device and storage medium; the embodiment of the present application obtains the web page content to be processed of a web page, wherein the web page content to be processed includes a web page content unit and its web page tag, and the web page content includes content characters and their corresponding identification tags; according to the web page tag and the identification tag, the position information of the content character in the web page can be identified, thereby determining the processing type of the content character; wherein, when the content character is a canvas drawing type, the content character is drawn on a preset canvas, and when the content character is a tag processing type, the identification tag corresponding to the content character is added to a preset tag set according to a preset rule; then, the target web page content of the web page is generated and output according to the current canvas and the current tag set, thereby effectively preventing crawlers from grabbing the content on the web page and improving the security of the web page content.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a web page content processing method, device, electronic device and storage medium. Background Art

[0002] With the development of Internet technology, the Internet has penetrated into every corner of daily social and economic life. Among them, web pages have become an important way of information transmission. People browse information through web pages, and companies carry out various activities such as production and marketing through web pages.

[0003] However, when using web pages to browse information, such as reading e-books, the content on the web page can be easily captured by crawlers. The crawlers only need to wait for the content on the web page to be loaded and then obtain the content displayed on the web page through scripts, resulting in low security of the web page content. Summary of the invention

[0004] The embodiments of the present application provide a web page content processing method, device, electronic device and storage medium, which can improve the security of web page content.

[0005] The present application provides a webpage content processing method, including:

[0006] Acquire the webpage content to be processed of the webpage, wherein the webpage content to be processed includes at least one webpage content unit and a webpage tag corresponding to the webpage content unit, wherein the webpage content unit includes at least one content character and an identification tag corresponding to the content character;

[0007] Identify the position information of the content characters in the web page according to the web page tag corresponding to the web page content unit and the identification tag corresponding to the content characters;

[0008] For each content character in the webpage content, determining a processing type of the content character according to position information of the content character in the webpage;

[0009] When the processing type of the content characters is a canvas drawing type, drawing the content characters on a preset canvas;

[0010] When the processing type of the content characters is a tag processing type, adding the identification tags corresponding to the content characters to a preset tag set in a preset order;

[0011] When the preset content generation condition is met, the target web page content of the web page is generated and output according to the current canvas and the current tag set.

[0012] Accordingly, the embodiment of the present application further provides a webpage content processing device, including:

[0013] An acquisition unit, used for acquiring the webpage content to be processed of the webpage, wherein the webpage content to be processed includes at least one webpage content unit and a webpage tag corresponding to the webpage content unit, wherein the webpage content unit includes at least one content character and an identification tag corresponding to the content character;

[0014] An identification unit, used to identify the position information of the content character in the web page according to the web page tag corresponding to the web page content unit and the identification tag corresponding to the content character;

[0015] A determination unit, configured to determine, for each content character in the webpage content, a processing type of the content character according to position information of the content character in the webpage;

[0016] A drawing unit, used for drawing the content characters on a preset canvas when the processing type of the content characters is a canvas drawing type;

[0017] an adding unit, configured to add the identification tags corresponding to the content characters to a preset tag set in a preset order when the processing type of the content characters is a tag processing type;

[0018] The generating unit is used to generate and output the target web page content of the web page according to the current canvas and the current tag set when the preset content generating condition is met.

[0019] In one embodiment, before the obtaining unit, the method further includes:

[0020] An acquisition subunit, configured to acquire initial webpage content of the webpage, wherein the initial webpage content includes at least one webpage tag and sub-webpage content corresponding to the webpage tag, wherein the sub-webpage content includes at least one content character;

[0021] A splitting subunit is used to split the content characters in the sub-webpage content to obtain an initial webpage content unit, wherein the initial webpage content unit includes at least one content character;

[0022] The adding subunit is used to add identification tags to the content characters in the initial web page content unit to obtain a web page content unit.

[0023] Among them, adding subunits can be used to:

[0024] Determining the number of content characters in the initial web page content unit;

[0025] Determining, according to the number of content characters in the initial web page content unit, identification tags corresponding to the content characters in the initial web page content unit;

[0026] According to the identification tag, the identification tag is added to the content characters in the initial web page content unit to obtain the web page content unit.

[0027] In one embodiment, the determining unit includes:

[0028] A comparison subunit, for comparing, for each content character in the webpage content, the position information of the content character in the webpage with the preset position information, to obtain a comparison result;

[0029] A determination subunit is used to determine the processing type of the content character according to the comparison result.

[0030] In one embodiment, the drawing unit includes:

[0031] A determination subunit, used for determining a drawing function for drawing the content characters when the processing type of the content characters is a canvas drawing type;

[0032] The drawing subunit is used to draw the content characters at the corresponding position of the preset canvas according to the drawing function and the position information of the content characters in the webpage.

[0033] In one embodiment, the adding unit comprises:

[0034] A determination subunit, configured to determine a corresponding tag sequence setting function according to a preset sequence when the processing type of the content character is a tag processing type;

[0035] The adding subunit is used to add the identification tags corresponding to the content characters to the preset tag set according to a preset order by using the tag order setting function.

[0036] In one embodiment, the generating unit comprises:

[0037] An inserting subunit, configured to insert the current canvas into a corresponding position of the web page according to position information of the content characters on the current canvas in the web page when a preset content generation condition is met;

[0038] The output subunit is used to output the content characters corresponding to the identification tags to the corresponding positions of the web page according to the order of the identification tags in the current tag set.

[0039] The embodiment of the present application also provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device performs the method provided in various optional modes of the above-mentioned aspect.

[0040] Correspondingly, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, and when the instructions are executed by a processor, any web page content processing method provided in the embodiments of the present application is implemented.

[0041] The embodiment of the present application obtains the webpage content to be processed of a webpage, wherein the webpage content to be processed includes at least one webpage content unit and a webpage tag corresponding to the webpage content unit, wherein the webpage content unit includes at least one content character and an identification tag corresponding to the content character; according to the webpage tag corresponding to the webpage content unit and the identification tag corresponding to the content character, the position information of the content character in the webpage is identified; for each content character in the webpage content, according to the position information of the content character in the webpage, the processing type of the content character is determined; when the processing type of the content character is a canvas drawing type, the content character is drawn on a preset canvas; when the processing type of the content character is a tag processing type, the identification tag corresponding to the content character is added to a preset tag set in a preset order; when the preset content generation condition is met, the target webpage content of the webpage is generated and output according to the current canvas and the current tag set. The scheme can effectively prevent crawlers from crawling content on webpages by drawing content characters of a processing type of canvas drawing type on a preset canvas, and adding identification tags of content characters of a processing type of tag processing type to a preset tag set in a preset order, thereby improving the security of network content. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0043] Figure 1 This is a schematic diagram of a scenario of the webpage content processing method provided by an embodiment of the present application;

[0044] Figure 2a It is a flow chart of a webpage content processing method provided by an embodiment of the present application;

[0045] Figure 2b is another scenario schematic diagram of the webpage content processing method provided by an embodiment of the present application;

[0046] Figure 2c This is a schematic diagram of web page content provided by an embodiment of the present application;

[0047] Figure 2dis another schematic diagram of webpage content provided by an embodiment of the present application;

[0048] Figure 2e It is a schematic diagram of position information of content characters provided in an embodiment of the present application;

[0049] Figure 2f This is another scenario schematic diagram of the webpage content processing method provided in the embodiment of the present application;

[0050] Figure 3a It is another flowchart of the network content processing method provided in the embodiment of the present application;

[0051] Figure 3b This is another scenario schematic diagram of the webpage content processing method provided in the embodiment of the present application;

[0052] Figure 4a It is a structural diagram of a network content processing device provided in an embodiment of the present application;

[0053] Figure 4b is another structural schematic diagram of the network content processing device provided in an embodiment of the present application;

[0054] Figure 5 It is a structural diagram of the network device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0055] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.

[0056] The embodiments of the present application provide a webpage content processing method, device, electronic device, and computer-readable storage medium. The webpage content processing device can be integrated in an electronic device, which can be a server or a terminal. The terminal can be an electronic device such as a laptop, a desktop computer, or a tablet computer (PC, Personal Computer) that has a storage unit and a microprocessor installed.

[0057] For example, the webpage content processing device is integrated into a terminal as an example for explanation. Figure 1As shown, first, the terminal obtains the web page content to be processed of the web page, and the web page content to be processed includes at least one web page content unit and a web page tag corresponding to the web page content unit, wherein the web page content unit includes at least one content character and an identification tag corresponding to the content character; then, the terminal can identify the position information of the content character in the web page according to the web page tag corresponding to the web page content unit and the identification tag corresponding to the content character; for each content character in the web page content, the terminal can determine the processing type of the content character according to the position information of the content character in the web page; when the processing type of the content character is a canvas drawing type, the terminal can draw the content character on a preset canvas; when the processing type of the content character is a tag processing type, the terminal adds the identification tag corresponding to the content character to a preset tag set in a preset order; when the preset content generation condition is met, the terminal generates and outputs the target web page content of the web page according to the current canvas and the current tag set.

[0058] The following are detailed descriptions respectively. It should be noted that the description order of the following embodiments is not intended to limit the preferred order of the embodiments.

[0059] The embodiments of the present application will be described from the perspective of a web page content processing device, which can be integrated into an electronic device, which can be a server, a terminal or other device.

[0060] like Figure 2a As shown, a web page content processing method is provided, and the specific process includes:

[0061] 101. Obtain to-be-processed web page content of a web page, where the to-be-processed web page content includes at least one web page content unit and a web page tag corresponding to the web page content unit, wherein the web page content unit includes at least one content character and an identification tag corresponding to the content character.

[0062] The web page content to be processed may include content displayed by a browser. For example, the web page content to be processed may include a browser document, etc. The browser document may be a document that can be recognized by the browser and rendered on a web page for display.

[0063] There may be multiple language formats for the web page content to be processed.

[0064] For example, the web page content to be processed may be a document written in Hyper Text Markup Language (HTML). Among them, the HTML document may be read by a variety of web browsers and generated to deliver various types of information. HTML may be an identification language, which includes a series of tags, through which the meaning and structure of the web page content are defined.

[0065] For another example, the web page content to be processed may be a document in which a scripting language such as JavaScript is embedded in HTML. JavaScript is an advanced scripting language used in network development. JavaScript can add a variety of dynamic functions to web pages, thereby making the presentation of web page content on the browser smoother and more beautiful. Documents such as JavaScript scripting languages ​​embedded in HTML can affect the behavior of web pages.

[0066] For another example, the web page content to be processed may be a document in which scripting languages ​​such as JavaScript and Cascading Style Sheets (CSS) are embedded in HTML. CSS is a language that defines style structures such as fonts, colors, positions, etc. It is used to describe the way information on a web page is formatted and displayed, and can affect the appearance and layout of the content presented in the web page.

[0067] In one embodiment, the content types of the webpage content to be processed may be multiple, for example, the webpage content to be processed may be one or more of text, pictures, tables, animations, and even music.

[0068] In one embodiment, the web page content to be processed may include at least one web page content unit and a web page tag corresponding to the web page unit, wherein the web page content unit may include at least one content character and an identification tag corresponding to the content character.

[0069] Among them, web page tags can be tags used to construct web page architecture, web page layout and carry content, that is, through web page tags, the browser can generate a web page architecture and layout corresponding to the web page tag and identify the content information marked by the web page tag, and according to the position information of the web page tag in the web page content to be processed, render the content marked by the web page tag to the corresponding position of the web page, so that the content marked by the web page tag is presented on the web page.

[0070] For example, in HTML, web page tags can be tags consisting of "<" and ">" and block-level elements wrapped by "<", ">". Block-level elements can be used to build network architecture, web page layout and carry content. For example, block-level elements can include head, div, p, body, etc. Therefore, web page tags can be, 、 , and other tags.

[0071] In one embodiment, web page tags all have corresponding functions. For example, some web page tags can define the style of the content they identify when presented in the browser, and some web page tags can define the presentation format of the content they identify in the browser, etc. For example, in HTML, tags can define information about the web page content to be processed, such as the encoding format of the web page content to be processed in the browser, etc.; Tags can define sections in the web page content to be processed; Tags can define paragraphs; tags can define topics, and so on.

[0072] In one embodiment, a web page tag may include a start tag and an end tag, and the content wrapped by the start tag and the end tag is the content presented on the web page, and the content wrapped by the start tag and the end tag may be presented on the web page according to the function of the tag. For example, in an HTML document, The label can include a start tag and the end tag is ,and The content identified by the label can be within and The content between and The content between them can be presented on the web page in the form of paragraphs.

[0073] For example, Figure 2b As shown, in the HTML1 document, The start tag of the label and the end tag The content wrapped in is "This is the first paragraph", and and The content between them can be presented on the web page as paragraphs, so "This is the first paragraph" will be presented on the web page as a paragraph.

[0074] For example, <title>The label can define a title in an HTML document. As shown in Figure 2b, in an HTML1 document, the start tag <title> and the end tag of the <title> label< / title> The content wrapped in the tag is "example", so the content "example" wrapped in the tag can be presented on the web page in the form of a title.

[0075] In one embodiment, the web page tag can be used alone. For example, <input> A label can appear alone and defines an input control.

[0076] In one embodiment, network tags can be nested with each other. Figure 2b As stated, Tags can be embedded in tags.

[0077] In one embodiment, the identification tag may be a tag carrying content. Through the identification tag, the browser may identify the content identified by the identification tag and the location information of the content identified by the identification tag, and render the content identified by the identification tag to the corresponding position of the webpage.

[0078] For example, in HTML, web page tags can be composed of "<" and ">" and inline elements wrapped in "<" and ">". Inline elements can be basic elements based on semantic level. For example, inline elements can include span, strong, em, etc. Therefore, the identification tag can be 、 <em>、 <strong>Each identification tag can identify the content information and location information of the web page content it identifies.

[0079] In one embodiment, the identification tag may include a start tag and an end tag, and the content wrapped by the start tag and the end tag may be the content presented on the web page, and the content wrapped by the start tag and the end tag may be presented on the web page according to the function of the tag. For example, in an HTML document, Tags can appear in pairs, starting with , its end tag is ,and The content of the tag can be and The content between.

[0080] In one embodiment, the identification tag can be used alone. For example, The tag can be used alone to identify an image.

[0081] In one embodiment, the identification tag can be embedded in a web page tag for further identification of the content identified in the web page tag. Figure 2c As shown, The label can be embedded in < / strong> < / em> <em> <strong>Tags used.

[0082] When the identification tag is embedded in a web page tag, the browser can not only identify the content and location information of the web page tag, but also the content and location information of the identification tag embedded in the web page tag. Figure 2c As shown, when the browser recognizes the content of the web page, it first recognizes the web page tag< / strong> < / em> <em> <strong>The content wrapped in it, and then identify two web page tags the content identified in. Among them, when the browser recognizes the first web page label , it can recognize the content it identifies as "What kind of people are written in this book?" and the position of the content it identifies in the web page. When recognizing the second web page label , the browser can not only recognize the content and location information it identifies, but also for the second web page label The browser can identify the content and location information of the identification tag. For example, the browser can identify the first identification tag The content of the mark "This is a group of forgotten people." and its location information can also identify the second identification tag The content of the logo "has" and its location information.

[0083] In one embodiment, the web page content unit may be a content unit in the web page content. For example, the web page content unit may be the smallest content unit in the web page content. For example, taking text content as an example, the web page content unit may be a paragraph, a sentence, a phrase, a character, etc. For another example, taking picture content as an example, the web page content unit may be a picture, etc.

[0084] In one embodiment, the web page content unit may include content characters. The content characters may be various symbols. For example, the content characters may be words used in various countries, may be relationship symbols that define the relationship between words, may be self-created symbols, etc. For example, the content characters may be Chinese characters, English letters, Arabic numerals, punctuation marks, Japanese, etc.

[0085] In one embodiment, in order to facilitate processing of content characters in web page content, a web page content unit may be composed of content characters and identification tags. For example, the identification tag may include a start tag and an end tag, and the start tag and the end tag and the content characters wrapped by the start tag and the end tag may constitute a web page content unit. Figure 2c As shown, There is " can constitute a web page content unit. For example, " This is a group of forgotten people. " can also constitute a web page content unit.

[0086] In one embodiment, the web page content to be processed may be stored in a storage medium with a storage function. For example, the web page content to be processed may be stored in a local server or terminal memory. When it is necessary to obtain the web page content to be processed, it may be directly obtained from the local server or terminal memory. For another example, the web page content to be processed may be stored in a non-local server or terminal memory. When it is necessary to obtain the web page content to be processed, a request may be made to the browser to obtain the web page content to be processed, and then the browser may obtain the web page content to be processed from the non-local server or terminal, and load the web page content to be processed into the browser. At this time, the web page content to be processed may be obtained through the browser.

[0087] In one embodiment, before obtaining the webpage content to be processed, the webpage content to be processed may be pre-processed using the word splitting method, thereby improving the efficiency of subsequent processing of the webpage content to be processed. Specifically, before the step of "obtaining the webpage content to be processed of the webpage", it also includes:

[0088] Acquire the initial webpage content of the webpage, wherein the initial webpage content includes at least one webpage tag and sub-webpage content corresponding to the webpage tag, wherein the sub-webpage content includes at least one content character;

[0089] Splitting the content characters in the sub-webpage content to obtain an initial webpage content unit, wherein the initial webpage content unit includes at least one content character;

[0090] Add identification tags to the content characters in the initial web page content unit to obtain a web page content unit.

[0091] The initial web page content may be the web page content obtained before the preprocessing of the web page content to be processed, and the initial web page content may be the web page content obtained without any processing. Figure 2d As shown, the initial web page content may be web page content in which the content characters do not have corresponding identification tags.

[0092] The language format of the initial webpage content may also be multiple. For example, the browser document may be an HTML document, or may be a document embedded in HTML such as JavaScript scripting language, or may be a document embedded in HTML such as JavaScript scripting language and CSS, etc.

[0093] In one embodiment, the initial web page content may be stored in a storage medium with a storage function. For example, the initial web page content may be stored in a local server or terminal memory. When it is necessary to obtain the web page content to be processed, it may be directly obtained from the local server or terminal memory. For another example, the initial web page content may be stored in a non-local server or terminal memory. When it is necessary to obtain the initial web page content, a request may be made to the browser to obtain the initial web page content first, and then the browser may obtain the initial web page content from the non-local server or terminal, and load the initial web page content into the browser. At this time, the initial web page content may be obtained through the browser.

[0094] In one embodiment, the initial web page content may include at least one web page tag and sub-web page content corresponding to the web page tag, wherein the sub-web page content includes at least one content character.

[0095] The sub-webpage content corresponding to the webpage tag may be a content segment with only the webpage tag identifier but no corresponding identification tag. Figure 2d As shown, in the initial web page content, the web page tag The content identified "How are you?" can be the content of a sub-web page, and another web page label The content of the logo "I'm fine." can also be a sub-page content.

[0096] In one embodiment, after the sub-webpage content is acquired, it is necessary to split the content characters in the sub-webpage content to obtain the initial webpage content unit.

[0097] Before splitting the characters in the sub-webpage content, the number of characters in the sub-webpage content can be identified, and a splitting rule can be determined according to the number of characters in the sub-webpage content. Then, the characters in the sub-webpage content can be split according to the splitting rule. Specifically, the step of "splitting the characters in the sub-webpage content to obtain the initial webpage content unit" includes:

[0098] Determining the number of content characters in the sub-page content;

[0099] Determine a splitting processing rule according to the number of characters in the content of the sub-webpage;

[0100] According to the splitting processing rule, the content characters in the sub-webpage content are split and processed to obtain the initial webpage content unit.

[0101] For example, when there is only one content character in the sub-webpage content, the content characters in the sub-webpage content can be directly split to obtain the initial webpage content unit.

[0102] For example, when there are multiple content characters in the sub-webpage content, each content character can be split according to the number of content characters in the sub-webpage content to obtain the initial webpage content unit. The content characters can also be split in pairs to obtain the initial webpage content unit, and so on.

[0103] In one embodiment, after the initial web page content unit is obtained, identification tags may be added to the content characters in the initial web page content unit to obtain the web page content unit.

[0104] Before adding the identification tag to the content characters in the initial web page content unit, the number of content characters in the initial web page content unit can be determined first, and then the identification tag can be determined according to the number of content characters in the initial web page content unit, and finally the identification tag can be added to the initial web page content unit. Specifically, the step of "adding the identification tag to the content characters in the initial web page content unit to obtain the web page content unit" includes:

[0105] Determining the number of content characters in the initial web page content unit;

[0106] Determining, according to the number of content characters in the initial web page content unit, identification tags corresponding to the content characters in the initial web page content unit;

[0107] According to the identification tag, the identification tag is added to the content characters in the initial web page content unit to obtain the web page content unit.

[0108] For example, when there is only one content character in the initial web page content unit, the identification tag may be a browser identification tag that can identify the position information of the content character in the initial web page content unit. Label, <strong>Label, <em>Tags and more tags.

[0109] For example, when there are multiple content characters in the initial web page content unit, the identification tag may be a browser identification tag capable of identifying position information of each content character in the initial web page content unit.

[0110] In one embodiment, the pre-processed initial web page content may be loaded on a browser for rendering, thereby obtaining the web page content to be processed.

[0111] 102. According to the web page tag corresponding to the web page content and the identification tag corresponding to the content character, identify the position information of the content character in the web page.

[0112] Wherein, the position information may include information describing the position of the content characters. For example, the position information of the content characters in the webpage may include positioning information and size information, etc. Wherein, the positioning information may include coordinate information of the content characters in the webpage, etc., and the size information may include the length, width, height, etc. of the content characters. Wherein, the position information may include a plurality of position parameters. Wherein, the position parameters may include parameters describing the position of the content characters. For example, the position information of the content characters in the webpage includes the width and height of the content characters, where the length of the content characters corresponds to one position parameter, and the height of the content characters corresponds to another position parameter.

[0113] In one embodiment, the web page can be set as a rectangular coordinate system, and the position information of the content characters in the web page can be represented by the coordinate information on the coordinate axis, wherein any point in the web page can be taken as the origin of the rectangular coordinate system.

[0114] For example, the upper left corner of the web page can be taken as the origin of the coordinate system, for example, Figure 2e As shown in 1021. The position information of the content characters in the web page can be represented by a rectangle (Rectangle, Rect) object. The Rect object corresponding to each content character can include four position parameters, namely (x, y, width, height). x can represent the horizontal coordinate of the upper left corner of the rectangle, that is, the horizontal coordinate of the content character in the web page; y can represent the vertical coordinate of the upper left corner of the rectangle, that is, the vertical coordinate of the content character in the web page; width can represent the width of the rectangle; height can represent the height of the rectangle.

[0115] The position information of the content characters in the web page can be determined according to the set coordinate system, for example, Figure 2e As shown, the web page is set to a rectangular coordinate system, where the value range of the x-axis is 0 to 50000 and the value range of the y-axis is 0 to 30000. At this time, the position information of "position" can be (100, 28000, 20, 35).

[0116] For another example, the center of the web page can be taken as the origin of the coordinate system, for example, Figure 2e As shown in 1022 in . Among them, the value range of the x-axis can be -25000 to 25000, and the value range of the y-axis can be -15000 to 15000. At this time, the position information of "position" can be (-24980, 14000, 20, 35), the position information of "position" can be (24980, -1400, 20, 35), and so on.

[0117] In one embodiment, the web page tag corresponding to the web page content and the identification tag corresponding to the content character can identify the content and position information of the content character identified by them, so the position information of the content character in the web page can be identified by the web page tag and the identification tag. For example, the content in the web page content to be processed can be traversed, and the content of the content character and the position information in the web page can be determined according to the traversed web page tags and identification tags.

[0118] For example, in an HTML document, the document object model (DOM) can be traversed on the web page content to be processed to obtain the network tags and identification tags in the web page content to be processed and the content and position information of the content characters corresponding to the network tags and identification tags.

[0119] For example, Figure 2e As shown, through DOM traversal, the network tag and the content characters identified by the identification tag can be obtained, which are "location" and the location information of "location" in the web page.

[0120] In one embodiment, the content of the content characters obtained by traversal and the position information in the webpage can be stored in a preset storage space.

[0121] For example, in a browser document in which a scripting language such as JavaScript is embedded in HTML, an array may be created to store the content information of the traversed content characters and the position information in the web page.

[0122] 103. For each content character in the webpage content, determine a processing type of the content character according to position information of the content character in the webpage.

[0123] The processing type may indicate the classification of the processing types of the content characters. For example, the processing type of the content characters may include a canvas drawing type and a tag processing type. When the processing type of the content characters is a canvas type, the content characters may be drawn on a preset canvas; when the processing type of the content characters is a tag processing type, the identification tags corresponding to the content characters may be added to a preset tag set in a preset order. In one embodiment, the processing type of the content characters may be directly determined according to the position information of each content character in the web page.

[0124] For example, when the position parameters of the content character are all positive numbers, the type of the content character is the canvas drawing type; otherwise, the type of the content character is the tag processing type. For example, when the web page is set to a rectangular coordinate system, and the center of the web page is the rectangular coordinate system, such as Figure 2e As shown in 1022 in the figure, the position information of "bit" can be (-24980, 14000, 20, 35), and the position information of "position" can be (24980, -1400, 20, 35). Since there are negative numbers in the position parameters of "bit" and "position", the types of "bit" and "position" are label processing types.

[0125] For another example, when a certain position parameter in the content character position information is a positive number, the type of the content character is a canvas drawing type; otherwise, the type of the content character is a label processing type. For example, the type of the content character can be determined according to the parameter corresponding to the content character on the horizontal axis. In this case, the type of "position" is a label processing type, and the processing type of "position" is a canvas drawing type.

[0126] In one embodiment, when the position parameter of the content character includes the width of the content character and the height of the content character, the height and width of the content character can be compared to determine the type of the content character. For example, when the width of the content character is greater than the height, the type of the content character is the canvas drawing type, when the width of the content character is less than or equal to the height, the type of the content character is the label processing type, and so on.

[0127] In one embodiment, the position information of each content character in the webpage can be compared with the preset position information, and then the processing type of the content character can be determined according to the comparison result. Specifically, the step of "for each content character in the webpage content, determining the processing type of the content character according to the position information of the content character in the webpage" includes:

[0128] For each content character in the webpage content, compare the position information of the content character in the webpage with the preset position information to obtain a comparison result;

[0129] The processing type of the content character is determined according to the comparison result.

[0130] Among them, the position information may include several position parameters, and the preset position information may also include several preset position parameters. One or more position parameters in the position information can be compared with one or more corresponding preset position parameters in the preset position information to obtain a comparison result, and then the processing type of the content characters can be determined based on the comparison result.

[0131] For example, when a web page is set as a rectangular coordinate system, where the upper left corner of the web page is the origin of the rectangular coordinate system, the position information of the content character may be (x, y, width, height), and the preset position information may be (x1, y1). Then, x and x1 may be compared to determine the processing type of the content character; y and y1 may also be compared to determine the processing type of the content character. Among them, x1 may be a value within the range of the ordinate, and y1 may be a value within the range of the abscissa.

[0132] For example, the web page is set as a rectangular coordinate system, where the value range of the x-axis is 0 to 50000 and the value range of the y-axis is 0 to 30000. The y1 in the preset position information can be set to 8000, and then the value y corresponding to the ordinate of each content character in the web page coordinate system is compared with 8000 to determine the processing type of the content character.

[0133] In one embodiment, the processing type of the content characters is determined based on the comparison result. When the position parameter in the position information is greater than or equal to the preset position parameter in the preset position information, the processing type of the content characters is the canvas drawing type; when the position parameter in the position information is less than the preset position parameter in the preset position information, the processing type of the content characters is the label processing type.

[0134] For example, y1 in the preset position information can be set to 8000. When y corresponding to the content character is greater than 8000, the processing type of the content character can be the canvas drawing type; when y corresponding to the content character is less than or equal to 8000, the processing type of the content character can be the label processing type.

[0135] In one embodiment, the processing type of the content characters is determined based on the comparison result. When the position parameter in the position information is greater than or equal to the preset position parameter in the preset position information, the processing type of the content characters is the label processing type; when the position parameter in the position information is less than the preset position parameter in the preset position information, the processing type of the content characters is the canvas drawing type.

[0136] For example, y1 in the preset position information can be set to 8000. When y corresponding to the content character is greater than or equal to 8000, the processing type of the content character can be a label processing type; when y corresponding to the content character is less than 8000, the processing type of the content character can be a canvas drawing type.

[0137] In one embodiment, after comparing the position information of each content character with the preset position information, the processing type of the content character may be determined according to the current comparison result.

[0138] For example, the position information corresponding to the content characters stored in the array may be extracted one by one and compared with the preset position information, and then the processing type of the content characters may be determined according to the current comparison result.

[0139] In one embodiment, after comparing the position information of each content character with the preset position information, each content character may be grouped according to the comparison result, and then the processing type may be determined for the grouped content characters.

[0140] For example, the position information corresponding to the content characters stored in the array can be extracted and compared with the preset position information, and then the content characters can be divided into a first content character group and a second content character group according to the comparison result. Among them, the content characters in the first content character group can be of the canvas drawing type, and the content characters in the second content character group can be of the label processing type; or the content characters in the first content character group can be of the label processing type, and the content characters in the second content character group can be of the canvas drawing type.

[0141] 104. When the processing type of the content characters is a canvas drawing type, the content characters are drawn on a preset canvas.

[0142] The canvas can be an image container in a browser document, and the image information in the browser document can be stored in the canvas. For example, in HTML, the canvas can be <canvas>The tag creates a canvas. <canvas>The tag has several built-in setting parameters, which can be set by <canvas>The parameters built into the tag can be set to customize the created canvas so that the created canvas can be adapted to the web page. For example, <canvas>The built-in parameters of include Width and Height, where Width can be the width of the canvas and Height can be the height of the canvas. By setting Width and Height, a canvas of a certain width and height is generated.

[0143] In one embodiment, when the processing type of the content characters is the canvas drawing type, the content characters can be drawn on a preset canvas using a drawing function. Specifically, the step of "when the processing type of the content characters is the canvas drawing type, drawing the content characters on a preset canvas" includes:

[0144] When the processing type of the content character is a canvas drawing type, determining a drawing function for drawing the content character;

[0145] According to the drawing function and the position information of the content characters in the webpage, the content characters are drawn at the corresponding position of the preset canvas.

[0146] The drawing function may be an operation function for drawing content characters on a preset canvas. For example, in HTML, the drawing function may be a fillText() function or a strokeText() function, etc. The fillText() function may be used to draw filled content characters, and the strokeText() function may be used to draw stroked content characters.

[0147] Among them, a number of setting parameters are built into the drawing function, and the style and position of the content characters drawn on the preset canvas can be adjusted by setting the parameters in the drawing function. For example, the fillText() function can be fillText(content characters, X, Y), wherein the parameter X can represent drawing the content characters on the horizontal axis of the web page and the position corresponding to X, and the parameter Y can represent drawing the content characters on the vertical axis of the web page and the position corresponding to Y. Specifically, X can correspond to the position information parameter x of the content characters on the web page, and Y can correspond to the position information parameter y of the content characters on the web page. For example, the fillText() function can be set to fillText(content characters, x, y). By setting the setting function of the drawing function, the content characters can be drawn on the position corresponding to the preset canvas.

[0148] The preset canvas can be a pre-generated canvas. For example, in HTML, you can <canvas>The tag creates a canvas and then draws the content characters on the preset canvas.

[0149] In one embodiment, before drawing the content characters on the preset canvas, the drawing environment on the preset canvas should also be obtained to avoid errors when drawing the content characters on the preset canvas. Specifically, an environment acquisition function can be used to obtain the drawing environment on the preset canvas. For example, in HTML, an environment acquisition function such as getContext() can be used to obtain an environment for drawing content characters on the preset canvas.

[0150] 105. When the processing type of the content characters is a tag processing type, adding identification tags corresponding to the content characters to a preset tag set in a preset order.

[0151] In one embodiment, when the processing type of the content characters is the tag processing type, a sequence setting function for setting the sequence of identification tags can be determined according to a preset sequence, and then the sequence setting function is used to add the identification tags corresponding to the content characters to the preset tag set according to the preset sequence. Specifically, the step of "when the processing type of the content characters is the tag processing type, adding the identification tags corresponding to the content characters to the preset tag set according to the preset sequence" includes:

[0152] When the processing type of the content characters is a tag processing type, determining a corresponding tag sequence setting function according to a preset sequence;

[0153] The tag sequence setting function is used to add the identification tags corresponding to the content characters to a preset tag set in a preset sequence.

[0154] The preset order may be the order in which the identification tags are added to the preset tag set. There may be multiple ordering methods in which the identification tags are added to the preset tag set, for example, the identification tags may be added to the preset tag set in a random order or in a regular manner.

[0155] The label order setting function may be a function determined according to a preset order.

[0156] For example, when adding identification tags to a preset tag set in a random order, the tag order setting function may be a random function. For example, in a document embedded in a scripting language such as JavaScript in HTML, the tag order setting function may be a function such as Math.random().

[0157] For example, when the identification tags are added to the preset tag set in a regular manner, the tag preset order function may be a function with a preset regularity.

[0158] The preset tag set may be a storage space capable of storing identification tags. For example, in a browser document embedded in an HTML document such as a JavaScript scripting language, the preset tag set may be an array, and identification tags may be added to the array in a preset order.

[0159] 106. When the preset content generation conditions are met, the target web page content of the web page is generated and output according to the current canvas and the current tag set.

[0160] The preset content generation condition may be a condition that the content to be processed satisfies the condition of being output to a web page after subsequent processing steps.

[0161] For example, the preset content generation condition may be that all content characters in the content to be processed have been processed, wherein the processing may be that when the processing type of the content characters is a canvas drawing type, the content characters are drawn on a preset canvas; when the processing type of the content characters is a label processing type, the identification labels corresponding to the content characters are added to a preset label set in a preset order.

[0162] The current canvas may be a canvas that carries all content characters whose processing type is canvas drawing type. The current tag set may be a tag set that stores all content characters whose processing type is tag processing type.

[0163] In one embodiment, the step of "generating and outputting target web page content of the web page according to the current canvas and the current tag set when the preset content generation condition is met" includes:

[0164] When the preset content generation condition is met, inserting the current canvas into the corresponding position of the web page according to the position information of the content characters on the current canvas in the web page;

[0165] According to the order of the identification tags in the current tag set, the content characters corresponding to the identification tags are output to the corresponding positions of the web page.

[0166] For example, the content characters on the current canvas include "I", "very", "good", ".", where the position information of the content characters in the web page is within the range of 8975 to 8940 in the vertical coordinate value and 200 to 280 in the horizontal coordinate value, so the canvas will be inserted into this range.

[0167] In one embodiment, when content characters are output to a web page according to the tag sequence identified in the tag set, the sequence of the content characters on the web page will change, thereby causing the content corresponding to the content characters to change. Figure 2f As shown, when processing the type, the identification tags of the content characters are added to the preset tag set in a preset order, and then the web page is directly generated according to the identification tags in the tag set. At this time, the order of the content on the web page will change, thereby affecting the meaning of the original content.

[0168] Therefore, in one embodiment, a positioning function for outputting content characters corresponding to the identification tags to corresponding positions on the web page can be determined based on the order of the identification tags in the current tag set, and then the positioning function can be used to output content characters corresponding to the identification tags to corresponding positions on the web page.

[0169] The original order positioning function can be added to the preset tag set to identify the function of positioning the tag to the original position according to the original order. For example, in a document in which HTML is embedded with scripting languages ​​such as JavaScript and CSS, the positioning function can be a positioning mechanism in CSS. Through the positioning mechanism in CSS, the position where the identification tag should appear relative to its original position can be positioned.

[0170] The web page content processing method introduced above, after obtaining the content to be processed of the web page, can identify the position information of the content characters in the web page according to the web page tags corresponding to the web page content units in the web page content and the identification tags corresponding to the content characters; then determine the processing type of the content characters according to the position information of the content characters in the web page; when the processing type of the content characters is the canvas drawing type, draw the content characters on a preset canvas, and when the content characters are the tag processing type, add the identification tags corresponding to the content characters to a preset tag set in a preset order; finally, generate and output the target web page content of the web page according to the current canvas and the current tag set, thereby effectively preventing crawlers from grabbing the content on the web page, thereby improving the security of the web page content.

[0171] According to the method described in the above embodiment, the following is further described in detail with examples.

[0172] The embodiment of the present application will take the webpage content processing device integrated on the terminal as an example to introduce the method of the embodiment of the present application.

[0173] like Figure 3a As shown, a webpage content processing method, the specific process is as follows:

[0174] 201. A terminal obtains initial webpage content of a webpage, where the initial webpage content includes at least one webpage tag and sub-webpage content corresponding to the webpage tag, wherein the sub-webpage content includes at least one content character.

[0175] The initial web page content may be the web page content obtained before the preprocessing of the web page content to be processed, that is, the initial web page content may be the web page content obtained without any processing. Figure 3b As shown, the initial web page content may be web page content that does not include an identification tag.

[0176] The language format of the initial webpage content may also be multiple. For example, the browser document may be an HTML document, or may be a document embedded in HTML such as JavaScript scripting language, or may be a document embedded in HTML such as JavaScript scripting language and CSS, etc.

[0177] In one embodiment, the initial web page content may include at least one web page tag and sub-web page content corresponding to the web page tag, wherein the sub-web page content includes at least one content character.

[0178] Among them, web page tags can be tags used to build web page structure, web page layout and carry content. For example, in HTML, web page tags can be tags composed of block-level elements. For example, as shown in the figure, web page tags can be tags,< / canvas> < / canvas> < / canvas> < / canvas> < / canvas> < / em> < / strong> <strong> <em>Tags and Label.

[0179] Through web page labels, a browser can generate a web page architecture and layout corresponding to the web page labels and identify the content information identified by the web page labels, and render the content identified by the web page labels to the corresponding positions on the web page according to the position information of the web page labels in the web page content to be processed, so that the content identified by the web page labels is presented on the web page.

[0180] Among them, the content characters can be various symbols. For example, the content characters can be the languages used in various countries, can be relational symbols that define the relationship between characters, and can also be self-created symbols, etc. For example, the content characters can be Chinese characters, English letters, Arabic numerals, punctuation marks, Japanese, etc. For example, as Figure 3b shown, in an HTML document, "你" is a content character, and "?" is also a content character.

[0181] Among them, the sub-web page content can be only the content character segment identified by the web page label. For example, as Figure 3b shown, the label and The sub-pages identified by the tags are "How are you?" and "I'm fine.", and the first The sub-web page content identified by the label is "How are you?", and the second The content of the sub-page identified by the tag is "I'm fine.".

[0182] In one embodiment, the initial web page content may be stored in a storage medium with a storage function. For example, the initial web page content may be stored in a local server or terminal memory. When it is necessary to obtain the web page content to be processed, it may be directly obtained from the local server or terminal memory. For another example, the initial web page content may be stored in a non-local server or terminal memory. When it is necessary to obtain the initial web page content, a request may be made to the browser to obtain the initial web page content first, and then the browser may obtain the initial web page content from the non-local server or terminal, and load the initial web page content into the browser. At this time, the initial web page content may be obtained through the browser.

[0183] 202. The terminal preprocesses content characters in the sub-webpage content to obtain the webpage content to be processed of the webpage, wherein the webpage content to be processed includes at least one webpage tag and sub-webpage content corresponding to the webpage tag, wherein the sub-webpage content includes at least one content character.

[0184] Among them, the identification tag can be a tag that carries content. Through the identification tag, the browser can identify the content identified by the identification tag and the location information of the content identified by the identification tag, and render the content identified by the identification tag to the corresponding position on the web page. For example, in HTML, the identification tag can be a tag composed of inline elements. For example, the identification tag can be 、 <em>or <strong>etc. tags.

[0185] The identification tag may include a start tag and an end tag, and the start tag and the end tag and the content wrapped by the start tag and the end tag may constitute a web page content unit.

[0186] For example, Figure 3b As shown, The start tag of a tag is , the end tag is , and "you" are wrapped in and between, so You Constitute a web page content unit. Similarly, Hello It also constitutes a web page content unit and so on.

[0187] In one embodiment, the terminal preprocessing the content characters in the sub-webpage content may include the terminal splitting the content characters in the sub-webpage content to obtain an initial webpage content unit, wherein the initial content unit includes at least one content character. Then, adding an identification tag to the content characters in the initial webpage content unit to obtain a webpage content unit. Finally, the webpage content to be processed of the webpage is obtained according to the webpage content unit.

[0188] In one embodiment, before splitting the characters in the sub-web page content, the number of content characters in the sub-web page content can be identified, and the splitting processing rules can be determined according to the number of content characters in the sub-web page content. Then, the content characters of the sub-web page content can be split according to the splitting processing rules to obtain initial web page content units.

[0189] For example, when there is only one content character in the sub-webpage content, the content characters in the sub-webpage content can be directly split to obtain the initial webpage content unit.

[0190] For example, when there are multiple content characters in the sub-webpage content, each content character can be split according to the number of content characters in the sub-webpage content to obtain the initial webpage content unit. The content characters can also be split in pairs to obtain the initial webpage content unit, and so on.

[0191] For example, Figure 3b As shown, it is recognized that the number of content characters in the sub-webpage content "How are you?" and "I'm fine." are both four. When the content characters in the sub-webpage content are split, the content characters in the sub-webpage content can be split one by one. That is, "How are you?" and "I'm fine." are split into "How are you?" and "I'm fine." respectively. Among them, each content character after the split constitutes an initial webpage unit. For example, "How are you?" is a complete initial webpage unit.

[0192] In one embodiment, after obtaining the initial web page content unit, the number of content characters in the initial web page content unit can be confirmed. Then, according to the number of content characters in the initial web page content unit, the identification tags corresponding to the content characters in the initial web page content unit are determined. Finally, the identification tags are added to the content characters in the initial web page content, thereby obtaining the web page content unit.

[0193] For example, when there is only one content character in the initial web page content unit, the identification tag may be a browser identification tag that can identify the position information of the content character in the initial web page content unit. Label, <strong>Label, <em>Labels such as tags.

[0194] For example, when there are multiple content characters in the initial web page content unit, the recognition tag can be a browser recognition tag that can recognize the position information of each content character in the initial web page content unit.

[0195] For example, there is only one content character "you" in the sub-web page content. Therefore, the recognition tag can be added to the content character "you" in the sub-web page content. , thereby obtaining the corresponding web page content unit You .

[0196] In one example, the web page content to be processed of the web page is obtained according to the web page content unit, and the terminal can load the web page content including the web page content unit into the browser for rendering, thereby obtaining the web page content to be processed.

[0197] 203. The terminal identifies the position information of the content characters in the web page according to the web page tag corresponding to the web page content and the identification tag corresponding to the content characters.

[0198] For example, in an HTML document, the document object model (DOM) can be traversed on the web page content to be processed to obtain the network tags and identification tags in the web page content to be processed and the content and position information of the content characters corresponding to the network tags and identification tags.

[0199] The position information of the content characters in the webpage may be information indicating the position of the content characters in the webpage.

[0200] In one embodiment, the web page can be set as a rectangular coordinate system, where the lower left corner of the web page can be the origin of the coordinate system, so that the position information of the traversed content characters in the web page can be represented by the coordinate information on the coordinate axis. Figure 3b As shown, the position information of the content characters in the web page obtained through DOM traversal can be represented by a rectangle (Rectangle, Rect) object. Among them, the Rect object corresponding to each content character can include four parameters, namely (x, y, width, height). Among them, x can represent the horizontal coordinate of the upper left corner of the rectangle, that is, the horizontal coordinate of the content character in the web page; y can represent the vertical coordinate of the upper left corner of the rectangle, that is, the vertical coordinate of the content character in the web page; width can represent the width of the rectangle, and height can represent the height of the rectangle. The position information of the content characters in the web page can be obtained through the Rect object.

[0201] For example, the web page is set as a rectangular coordinate system, where the value range of the x-axis is 0-50000 and the value range of the y-axis is 0-30000. The position information of the content characters "Are you good?" can be (200, 9000, 20, 35), (220, 9000, 20, 35), (240, 9000, 20, 35) and (260, 9000, 20, 35). The position information of the content characters "I am very good." can be (200, 8975, 20, 35), (220, 8975, 20, 35), (240, 8975, 35) and (260, 8975, 20, 35).

[0202] The content of the content characters obtained through traversal and the position information in the web page can be stored in a preset storage space.

[0203] For example, in a browser document embedded in an HTML document using a scripting language such as JavaScript, an array may be created to store the content of the traversed content characters and the position information in the web page.

[0204] 204. The terminal determines, for each content character in the webpage content, a processing type of the content character according to position information of the content character in the webpage.

[0205] In one embodiment, the position information of each content character in the webpage may be compared with the preset position information, and then the processing type of the content character may be determined according to the comparison result.

[0206] Among them, the position information may include several position parameters, and the preset position information may also include several preset position parameters. One or more position parameters in the position information can be compared with one or more corresponding preset position parameters in the preset position information to obtain a comparison result, and then the processing type of the content characters can be determined based on the comparison result.

[0207] For example, when a web page is set as a rectangular coordinate system, where the lower left corner of the web page is the origin of the rectangular coordinate system, the position information of the content character may be (x, y, width, height), and the preset position information may be (x1, y1). Then, x and x1 may be compared to determine the processing type of the content character; y and y1 may also be compared to determine the processing type of the content character. Among them, x1 may be a value within the range of the ordinate, and y1 may be a value within the range of the abscissa.

[0208] In one embodiment, the terminal determines the processing type of the content characters based on the comparison result. When the position parameter in the position information is less than the preset position parameter in the preset position information, the processing type of the content characters is the canvas drawing type; when the position parameter in the position information is greater than or equal to the preset position parameter in the preset position information, the processing type of the content characters is the label processing type.

[0209] For example, Figure 3b As shown, when y1 in the preset position information is set to 8980, the y corresponding to the content characters "Are you okay?" is greater than 8980, so the processing type of the content characters "Are you okay?" can be a label processing type; the y corresponding to the content characters "I am very good." is less than 8980, so the processing type of the content characters "I am very good." can be a canvas drawing type.

[0210] The terminal may extract the position information corresponding to the content characters stored in the array one by one and compare them with the preset position information, and then directly determine the processing type of the content characters according to the comparison result.

[0211] 205. When the processing type of the content characters is a canvas drawing type, the terminal draws the content characters on a preset canvas.

[0212] In one embodiment, when the processing type of the content characters is a canvas drawing type, the content characters can be drawn on a preset canvas using a drawing function. The drawing function can be an operation function for drawing the content characters on a preset canvas. For example, the drawing function can be a fillText() function, etc.

[0213] Among them, the drawing function has several setting parameters built in, and the style and position of the content characters drawn on the preset canvas can be adjusted by setting the parameters in the drawing function.

[0214] For example, the fillText() function may be fillText(content characters, X, Y), wherein the parameter X may indicate that the content characters are drawn at a position corresponding to X on the horizontal axis of the webpage, and the parameter Y may indicate that the content characters are drawn at a position corresponding to Y on the vertical axis of the webpage. Specifically, X may correspond to the position information parameter x of the content characters on the webpage, and Y may correspond to the position information parameter y of the content characters on the webpage. For example, the fillText() function may be set to fillText(content characters, x, y). By setting the setting function of the drawing function, the content characters may be drawn at a position corresponding to a preset canvas.

[0215] For example, when the processing type is the canvas drawing type and the content characters are "I" "very" "good" ".", the terminal can use the fillText() function to draw the content characters at the corresponding position of the preset canvas. For example, when "I" is drawn on the canvas, the fillText() function can be set to fillText(I, 200, 8970); when "very" is drawn on the canvas, the fillText() function can be set to fillText(very, 220, 8970).

[0216] 206. When the processing type of the content characters is a tag processing type, the terminal adds the identification tags corresponding to the content characters to a preset tag set according to a preset order.

[0217] In one embodiment, when the processing type of the content characters is the tag processing type, an order setting function for setting the identification tag order can be determined according to a preset order, and then the identification tags corresponding to the content characters are added to the preset tag set according to the preset order using the order setting function.

[0218] The preset order may be the order in which the identification tags are added to the preset tag set. For example, the terminal may add the identification tags to the preset tag set in a random order.

[0219] For example, when adding identification tags to the preset tag set in a random order, the order setting function may be a random function. For example, in a document such as a JavaScript scripting language embedded in an HTML document, the order setting function may be a Math.random() function.

[0220] For example, when the processing type is the tag processing type and the content character is "are you good?", the terminal can use Math.random() to convert the content character "are you good?" into the corresponding identification tag Randomly added to a preset tag set.

[0221] Among them, the preset tag set can be a storage space capable of storing recognition tags. For example, in a browser document such as an HTML document embedded with a JavaScript scripting language, the preset tag set can be an array.

[0222] 207. When the preset content generation condition is met, the terminal generates and outputs the target web page content of the shown web page according to the current canvas and the current tag set.

[0223] Among them, the preset content generation condition can be that the content to be processed meets the condition of being output to the web page after subsequent processing steps.

[0224] For example, the preset content generation condition can be that all content characters in the content to be processed have been processed. Among them, the processing can be that when the processing type of the content character is the canvas drawing type, the content character is drawn on the preset canvas; when the processing type of the content character is the tag processing type, the recognition tags corresponding to the content characters are added to the preset tag set in the preset order.

[0225] Among them, the current canvas can be a canvas on which all content characters with the processing type of the canvas drawing type are drawn. For example, the current canvas can be a canvas on which the content characters "我”"很”"好”"。” are drawn.

[0226] Among them, the current tag set can be a tag set that stores all content characters with the processing type of the tag processing type. For example, the current tag set can be a tag set that stores the recognition tags corresponding to the content characters "你”"好”"吗”"?” Set of labels.

[0227] In one embodiment, the current canvas may be inserted into a corresponding position on the web page according to the position information of the content characters on the current canvas in the web page.

[0228] For example, the content characters on the current canvas include "I", "very", "good", ".", where the position information of the content characters in the web page is within the range of 8975 to 8940 in the vertical coordinate value and 200 to 280 in the horizontal coordinate value, so the canvas will be inserted into this range.

[0229] In one embodiment, a positioning function for obtaining the original order of identification tags can be determined according to a preset order, and then the terminal uses the positioning function to output content characters corresponding to the identification tags in the current tag set to corresponding positions on the web page.

[0230] The original order of the identification tags may be the order in which the identification tags have not yet been added to the preset tag set according to the preset order.

[0231] The original order positioning function may be a function for positioning the identification tags added to the preset tag set to the original position according to the original order of the identification tags. For example, in a document in which a scripting language such as JavaScript and CSS are embedded in an HTML document, the positioning function may be a positioning mechanism in CSS. The positioning mechanism in CSS may be used to locate the position where the identification tag should appear relative to its original position.

[0232] In the web page content processing method introduced above, the terminal obtains the initial web page content of the web page, wherein the initial web page content includes at least one web page tag and the sub-web page content corresponding to the web page tag, and the sub-web page content includes at least one content character; then the terminal processes the content characters in the sub-web page content to obtain the web page content to be processed of the web page, wherein the web page content to be processed includes a web page content unit and a web page tag corresponding to the web page content, and the web page content unit includes content characters and identification tags corresponding to the content characters; the terminal determines the processing type of the content characters according to the position information of the content characters in the web page; when the processing type of the content characters is a canvas drawing type, the terminal draws the content characters on a preset canvas; when the processing type of the content characters is a tag processing type, the terminal adds the identification tags corresponding to the content characters to a preset tag set in a preset order; finally, when the preset content generation conditions are met, the terminal generates and outputs the target web page content of the web page according to the current canvas and the current tag set; through the above method, crawlers can be effectively prevented from grabbing content on the web page, thereby improving the security of the web page content.

[0233] In order to better implement the webpage content processing method provided in the embodiment of the present application, a webpage content processing device is also provided in one embodiment, and the webpage content processing device can be integrated in a terminal or a server. The meanings of the terms are the same as those in the above webpage content processing method, and the specific implementation details can refer to the description in the method embodiment.

[0234] In one embodiment, a web page content processing device is provided. The web page processing device can be integrated in a terminal such as a web page content processing terminal. Figure 4a As shown, the webpage content processing device includes: an acquisition unit 301, an identification unit 302, a determination unit 303, a drawing unit 304, an adding unit 305, and a generation unit 306, which are specifically as follows:

[0235] The acquisition unit 301 is used to acquire the webpage content to be processed of the webpage, wherein the webpage content to be processed includes at least one webpage content unit and a webpage tag corresponding to the webpage content unit, wherein the webpage content unit includes at least one content character and an identification tag corresponding to the content character;

[0236] An identification unit 302 is used to identify the position information of the content character in the web page according to the web page tag corresponding to the web page content unit and the identification tag corresponding to the content character;

[0237] The determination unit 303 is used to determine, for each content character in the webpage content, a processing type of the content character according to the position information of the content character in the webpage;

[0238] A drawing unit 304, used for drawing the content characters on a preset canvas when the processing type of the content characters is a canvas drawing type;

[0239] An adding unit 305, configured to add the identification tags corresponding to the content characters to a preset tag set in a preset order when the processing type of the content characters is a tag processing type;

[0240] The generating unit 306 is configured to generate and output the target web page content of the web page according to the current canvas and the current tag set when a preset content generating condition is met.

[0241] In one embodiment, if Figure 4b As shown, the determining unit 303 may include:

[0242] The comparison subunit 3031 is used to compare the position information of each content character in the webpage content with the preset position information to obtain a comparison result;

[0243] The determination subunit 3032 is used to determine the processing type of the content character according to the comparison result.

[0244] In one embodiment, if Figure 4b As shown, the drawing unit 304 may include:

[0245] A determination subunit 3041, used for determining a drawing function for drawing the content characters when the processing type of the content characters is a canvas drawing type;

[0246] The drawing subunit 3042 is used to draw the content characters at the corresponding position of the preset canvas according to the drawing function and the position information of the content characters in the webpage.

[0247] In one embodiment, if Figure 4b As shown, the adding unit 305 may include:

[0248] A determination subunit 3051 is used to determine a corresponding tag sequence setting function according to a preset sequence when the processing type of the content character is a tag processing type;

[0249] The adding subunit 3052 is used to add the identification tags corresponding to the content characters to the preset tag set according to a preset order by using the tag order setting function.

[0250] In one embodiment, if Figure 4b As shown, the generating unit 306 may include:

[0251] The inserting subunit 3061 is used to insert the current canvas into the corresponding position of the web page according to the position information of the content characters on the current canvas in the web page when the preset content generation condition is met;

[0252] The output subunit 3062 is used to output the content characters corresponding to the identification tags to the corresponding positions of the web page according to the order of the identification tags in the current tag set.

[0253] In specific implementation, the above units can be implemented as independent entities, or can be arbitrarily combined to be implemented as the same or several entities. The specific implementation of the above units can refer to the previous method embodiments, which will not be repeated here.

[0254] The web page content processing device can effectively prevent crawlers from grabbing the content on the web page.

[0255] The present application also provides a computer device, which may include a terminal or a server. For example, the computer device may be used as a web content processing terminal, which may be a mobile phone, a tablet computer, etc.; for another example, the computer device may be a server, such as a web content processing server. Figure 5 Acquire the webpage content to be processed of the webpage, wherein the webpage content to be processed includes at least one webpage content unit and a webpage tag corresponding to the webpage content unit, wherein the webpage content unit includes at least one content character and an identification tag corresponding to the content character;

[0256] Identify the position information of the content characters in the web page according to the web page tag corresponding to the web page content unit and the identification tag corresponding to the content characters;

[0257] For each content character in the webpage content, determining a processing type of the content character according to position information of the content character in the webpage;

[0258] When the processing type of the content characters is a canvas drawing type, drawing the content characters on a preset canvas;

[0259] When the processing type of the content characters is a tag processing type, adding the identification tags corresponding to the content characters to a preset tag set in a preset order;

[0260] When the preset content generation condition is met, the target web page content of the web page is generated and output according to the current canvas and the current tag set.

[0261] like Figure 5 As shown, it shows a schematic diagram of the structure of the terminal involved in the embodiment of the present application, specifically:

[0262] The computer device may include components such as a processor 401 with one or more processing cores, a memory 402 with one or more computer-readable storage media, a power supply 403, and an input unit 404. Those skilled in the art will appreciate that Figure 5 The computer device structure shown in the figure does not constitute a limitation on the computer device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. Among them:

[0263] The processor 401 is the control center of the computer device. It uses various interfaces and lines to connect various parts of the entire computer device. By running or executing software programs and / or modules stored in the memory 402 and calling data stored in the memory 402, it executes various functions of the computer device and processes data, thereby performing overall detection of the computer device. Optionally, the processor 401 may include one or more processing cores; preferably, the processor 401 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 401.

[0264] The memory 402 can be used to store software programs and modules. The processor 401 executes various functional applications and data processing by running the software programs and modules stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 402 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 with access to the memory 402.

[0265] The computer device also includes a power supply 403 for supplying power to various components. Preferably, the power supply 403 can be logically connected to the processor 401 through a power management system, so as to manage charging, discharging, and power consumption through the power management system. The power supply 403 can also include any components such as one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, and power status indicators.

[0266] The computer device may further include an input unit 404, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.

[0267] Although not shown, the computer device may further include a display unit, etc., which will not be described in detail herein. Specifically in this embodiment, the processor 401 in the computer device will load the executable files corresponding to the processes of one or more application programs into the memory 402 according to the following instructions, and the processor 401 will run the application programs stored in the memory 402, thereby realizing various functions, as follows:

[0268] It can be seen from the above that the terminal provided in the embodiment of the present application can effectively prevent crawlers from grabbing content on web pages, thereby improving the security of web page content.

[0269] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.

[0270] The storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0271] Since the instructions stored in the storage medium can execute the steps in any web page content processing method provided in the embodiments of the present application, the beneficial effects that can be achieved by any web page content processing method provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.

[0272] In addition, an embodiment of the present application provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the method provided in various optional modes of the above-mentioned first aspect.

[0273] For example, the computer program may perform the following steps:

[0274] Acquire the webpage content to be processed of the webpage, wherein the webpage content to be processed includes at least one webpage content unit and a webpage tag corresponding to the webpage content unit, wherein the webpage content unit includes at least one content character and an identification tag corresponding to the content character;

[0275] Identify the position information of the content characters in the web page according to the web page tag corresponding to the web page content unit and the identification tag corresponding to the content characters;

[0276] For each content character in the webpage content, determining a processing type of the content character according to position information of the content character in the webpage;

[0277] When the processing type of the content characters is a canvas drawing type, drawing the content characters on a preset canvas;

[0278] When the processing type of the content characters is a tag processing type, adding the identification tags corresponding to the content characters to a preset tag set in a preset order;

[0279] When the preset content generation condition is met, the target web page content of the web page is generated and output according to the current canvas and the current tag set.

[0280] The web page content processing method, device, electronic device and storage medium provided in the embodiments of the present application are introduced in detail above. The principles and implementation methods of the present application are explained in this article using specific examples. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for technical personnel in this field, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application. < / em> < / strong> < / strong> < / em> < / em> < / strong> < / strong> < / em>

Claims

1. A web page content processing method, characterized in that: include: Acquire the webpage content to be processed of the webpage, wherein the webpage content to be processed includes at least one webpage content unit and a webpage tag corresponding to the webpage content unit, wherein the webpage content unit includes at least one content character and an identification tag corresponding to the content character; Identify the position information of the content character in the web page according to the web page tag corresponding to the web page content unit and the identification tag corresponding to the content character; wherein the position information includes a plurality of position parameters, and the position parameters include parameters describing the position of the content character; For each content character in the webpage content, determining a processing type of the content character according to position information of the content character in the webpage; When the processing type of the content characters is a canvas drawing type, drawing the content characters on a preset canvas; When the processing type of the content characters is a tag processing type, adding the identification tags corresponding to the content characters to a preset tag set in a preset order; When the preset content generation condition is met, the target web page content of the web page is generated and output according to the current canvas and the current tag set.

2. The webpage content processing method according to claim 1, characterized in that: For each content character in the webpage content, determining the processing type of the content character according to the position information of the content character in the webpage includes: For each content character in the webpage content, compare the position information of the content character in the webpage with the preset position information to obtain a comparison result; The processing type of the content character is determined according to the comparison result.

3. The webpage content processing method according to claim 1, characterized in that: When the processing type of the content characters is a canvas drawing type, drawing the content characters on a preset canvas includes: When the processing type of the content character is a canvas drawing type, determining a drawing function for drawing the content character; According to the drawing function and the position information of the content characters in the webpage, the content characters are drawn at the corresponding position of the preset canvas.

4. The webpage content processing method according to claim 1, characterized in that: When the processing type of the content character is a tag processing type, adding the identification tag corresponding to the content character to the preset tag set in a preset order includes: When the processing type of the content characters is a tag processing type, determining a corresponding tag sequence setting function according to a preset sequence; The tag sequence setting function is used to add the identification tags corresponding to the content characters to a preset tag set in a preset sequence.

5. The webpage content processing method according to claim 1, characterized in that: Before obtaining the web page content to be processed of the web page, it also includes: Acquire the initial webpage content of the webpage, wherein the initial webpage content includes at least one webpage tag and sub-webpage content corresponding to the webpage tag, wherein the sub-webpage content includes at least one content character; Splitting the content characters in the sub-webpage content to obtain an initial webpage content unit, wherein the initial webpage content unit includes at least one content character; Add identification tags to the content characters in the initial web page content unit to obtain a web page content unit.

6. The webpage content processing method according to claim 5, characterized in that: Adding identification tags to the content characters in the initial web page content unit to obtain a web page content unit includes: Determining the number of content characters in the initial web page content unit; Determining, according to the number of content characters in the initial web page content unit, identification tags corresponding to the content characters in the initial web page content unit; According to the identification tag, the identification tag is added to the content characters in the initial web page content unit to obtain the web page content unit.

7. The webpage content processing method according to claim 1, characterized in that: When the preset content generation conditions are met, the target webpage content of the webpage is generated and output according to the current canvas and the current tag set, including: When the preset content generation condition is met, inserting the current canvas into the corresponding position of the web page according to the position information of the content characters on the current canvas in the web page; According to the order of the identification tags in the current tag set, the content characters corresponding to the identification tags are output to the corresponding positions of the web page.

8. A web page content processing device, characterized in that: include: An acquisition unit, used for acquiring the webpage content to be processed of the webpage, wherein the webpage content to be processed includes at least one webpage content unit and a webpage tag corresponding to the webpage content unit, wherein the webpage content unit includes at least one content character and an identification tag corresponding to the content character; an identification unit, configured to identify position information of the content character in the web page according to the web page tag corresponding to the web page content unit and the identification tag corresponding to the content character; wherein the position information includes a plurality of position parameters, and the position parameters include parameters describing the position of the content character; A determination unit, configured to determine, for each content character in the webpage content, a processing type of the content character according to position information of the content character in the webpage; A drawing unit, used for drawing the content characters on a preset canvas when the processing type of the content characters is a canvas drawing type; an adding unit, configured to add the identification tags corresponding to the content characters to a preset tag set in a preset order when the processing type of the content characters is a tag processing type; The generating unit is used to generate and output the target web page content of the web page according to the current canvas and the current tag set when the preset content generating condition is met.

9. An electronic device, characterized in that: It comprises a memory and a processor; the memory stores an application program, and the processor is used to run the application program in the memory to execute the operations in the web page content processing method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the steps in the webpage content processing method according to any one of claims 1 to 7.