Webpage anti-crawler text processing method and device, storage medium and computer

By splitting the text to be displayed into multiple text character groups and adding occupancy characters, forming multiple text layers, and finally occluding and superimposing, the problem of insufficient anti-crawler capabilities of web pages in the prior art is solved, and the anti-crawler capabilities of web pages and the security of page information is significantly improved.

CN119598508APending Publication Date: 2025-03-11CHINA PING AN LIFE INSURANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411648356.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-18
Publication Date
2025-03-11

AI Technical Summary

Technical Problem

In the prior art, financial and insurance institutions have low anti-crawling capabilities on web pages and cannot effectively protect confidential and sensitive information on Internet pages.

Method used

By splitting the text to be displayed into multiple text character groups and adding occupancy characters to each text character group, multiple text layers are formed, and finally occluding and overlaying these text layers, generating a text display layer and setting it on the web page.

Benefits of technology

It significantly improves the anti-crawler capability of web pages, making it impossible for web page crawlers to restore the text to be displayed based on text characters and occupied characters, enhancing the security of page information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119598508A_ABST
    Figure CN119598508A_ABST
Patent Text Reader

Abstract

The invention discloses a webpage anti-crawler text processing method and device, a storage medium and a computer, and relates to the technical field of data security. The method is used for performing webpage anti-crawler processing on a text set on a webpage, and comprises the following steps: acquiring a to-be-displayed text, and dividing a plurality of text characters contained in the to-be-displayed text into a preset number of text character groups; adding occupation characters into each text character group to obtain a plurality of text segments, and rubbing each text segment onto different layers to obtain a plurality of text layers; shielding the occupied characters in each text layer so as to enable the occupied characters to be in an invisible state in the text layer; and superposing the plurality of text layers to obtain a text display layer, and setting the text display layer to the webpage. According to the method, the anti-crawler capability of the webpage can be remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data security technology, and in particular to a text processing method, device, storage medium and computer for web page anti-crawler. Background Art

[0002] In recent years, with the rapid development of Internet technology, the text information provided on the Internet has become increasingly abundant. In the fields of finance and insurance, the number of information pages set up by financial and insurance institutions on Internet pages has also increased significantly. At present, the information set up by financial and insurance institutions on Internet pages may involve confidential information and sensitive information of financial and insurance institutions, and the above information needs to be protected. However, with the development of Internet technology, web crawler technology is also developing synchronously. Among them, web crawler technology is a technology that automatically obtains information on the Internet through a program. It can obtain various text information on the Internet. When web crawlers are abused, a lot of original information will not be protected.

[0003] At present, in order to prevent confidential or sensitive information on Internet pages from being directly identified and captured by web crawlers, financial and insurance institutions use existing anti-crawling methods, including: marking the corresponding text information and then shuffling the order; or remapping the character encoding corresponding to the text information to hide the true meaning of the characters, etc.

[0004] However, for the first solution, since the web crawler can obtain the original information of the characters on the web page, even after the order of the characters on the web page is disrupted, the web crawler can still use the algorithm to crawl most of the key information and sensitive information, resulting in relatively low security. The second solution can prevent the web crawler from crawling the corresponding character encoding and identifying character gaps, but the web crawler can directly identify the font style of the text information on the web page to achieve the purpose of obtaining information, resulting in its security is also not high. Therefore, how to improve the anti-crawler ability of the web page and improve the security of the page information of the web page is a technical problem that needs to be solved urgently. Summary of the invention

[0005] In view of this, the present application provides a text processing method, device, storage medium and computer for web page anti-crawler, the main purpose of which is to solve the technical problem of low web page anti-crawler capability of current financial and insurance institutions.

[0006] According to a first aspect of the present invention, a method for processing text to prevent web crawlers is provided, which is used to perform web crawler processing on text set on a web page. The method comprises:

[0007] Acquire a text to be displayed, and divide a plurality of text characters contained in the text to be displayed into a preset number of text character groups;

[0008] Adding occupied characters to each of the text character groups to obtain a plurality of text segments, and printing each of the text segments on different layers to obtain a plurality of text layers;

[0009] Masking the occupied characters in each of the text layers so that the occupied characters are invisible in the text layer;

[0010] A plurality of the text layers are superimposed to obtain a text display layer, and the text display layer is set at the web page.

[0011] According to a second aspect of the present invention, a text processing device for webpage anti-crawler is provided, the device comprising:

[0012] A text acquisition module, used for acquiring a text to be displayed, and dividing a plurality of text characters contained in the text to be displayed into a preset number of text character groups;

[0013] A character adding module, used for adding occupied characters to each of the text character groups to obtain a plurality of text segments, and printing each of the text segments on different layers to obtain a plurality of text layers;

[0014] A character shielding module, used for shielding the occupied characters in each of the text layers, so that the occupied characters are invisible in the text layer;

[0015] The text overlay module is used to overlay a plurality of the text layers to obtain a text display layer, and set the text display layer to the web page.

[0016] According to a third aspect of the present invention, there is provided a storage medium on which a computer program is stored, and when the program is executed by a processor, the above-mentioned text processing method for web page anti-crawler is implemented.

[0017] According to a fourth aspect of the present invention, there is provided a computer comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned text processing method for web page anti-crawler when executing the program.

[0018] The present invention provides a text processing method, device, storage medium and computer for webpage anti-crawler. First, all text characters of the text to be displayed on the webpage are divided into multiple text character groups, wherein each text character group includes multiple text characters. Then, an occupied character for confusing the webpage crawler is added to each text character group, and the text character group with the occupied character is determined as a text segment. Further, each text segment is printed on different layers to obtain multiple text layers. Then, the occupied characters in each text layer are shielded so that the occupied characters are in an invisible state in the text layer. Finally, the multiple text layers are superimposed, and the text display layer formed after the superposition is set to the webpage, so that the text characters in the text display layer are in a visible state on the webpage, and the occupied characters in the text display layer are in an invisible state on the webpage because they are shielded, so that it will not cause obstacles to the relevant personnel to read the text in the text display layer. As for web crawlers, they will crawl the text characters in the text display layer and the occupied characters that serve as obfuscation, making it impossible for the web crawlers to restore the to-be-displayed text that needs to be protected from web crawlers based on the text characters and occupied characters, thereby significantly improving the anti-crawler capabilities of the web page.

[0019] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0021] Figure 1 A schematic diagram showing a flow chart of a text processing method for webpage anti-crawler provided by an embodiment of the present invention;

[0022] Figure 2 A schematic diagram of a text layer provided by an embodiment of the present invention is shown;

[0023] Figure 3 A schematic diagram of a text layer after occlusion processing provided by an embodiment of the present invention is shown;

[0024] Figure 4 A schematic diagram of a text display layer provided by an embodiment of the present invention is shown;

[0025] Figure 5A schematic diagram of the structure of a text processing device for webpage anti-crawler provided by an embodiment of the present invention is shown;

[0026] Figure 6 A schematic diagram of the structure of a computer for executing a text processing method for web page anti-crawler provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0027] The present invention will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that the embodiments and features in the embodiments of the present application can be combined with each other without conflict.

[0028] At present, in order to prevent confidential information or sensitive information on Internet pages from being directly identified and captured by web crawlers, financial and insurance institutions use existing anti-crawling methods, including: marking the corresponding text information and then disrupting the order; or remapping the character encoding corresponding to the text information to hide the true meaning of the characters. However, for the first solution mentioned above, because the web crawler can obtain the original information of the characters on the web page, even after the order of the characters on the web page is disrupted, the web crawler can use the algorithm to obtain most of the key information and sensitive information, resulting in relatively low security. The second solution can prevent the web crawler from crawling the corresponding character encoding and identifying character vacancies, but the web crawler can directly identify the font style of the text information on the web page to achieve the purpose of obtaining information, resulting in its security is also not high. Therefore, how to improve the anti-crawling ability of web pages and provide the security of the page information of web pages is a technical problem that needs to be solved urgently.

[0029] In one embodiment, Figure 1 As shown, a text processing method for webpage anti-crawler is provided, which is used to perform webpage anti-crawler processing on text set on a webpage. The method is applied to a computer as an example for explanation, and includes the following steps:

[0030] 101. Obtain a text to be displayed, and divide a plurality of text characters contained in the text to be displayed into a preset number of text character groups.

[0031] The text to be displayed may be text information to be set on a web page, including text sentences and text words, etc. For example, the text to be displayed may be "My home and I cannot be separated for even a moment!".

[0032] Furthermore, the text characters in the text to be displayed include words and symbols. For example, the text characters contained in "My home and I cannot be separated for a moment!" are "I", "and", "me", "of", "home", "garden", ","", "one", "moment", "also", "not", "can", "divide", "cut" and "!".

[0033] Further, the above-mentioned text characters can be randomly divided into a preset number of text character groups. As an example, the value of the preset number can be three, and the specific value of the preset number can be determined according to the actual situation. Here, "我 (I)", "和 (and)", ", (comma)", "一 (one)", and "也 (also)" can be divided into the first text character group, "我 (I)", "的 (of)", "刻 (carve)", "分 (divide)", "割 (cut)", and "! (exclamation mark)" can be divided into the second text character group, and "家 (home)", "园 (garden)", "不 (not)", and "能 (can)" can be divided into the third text character group.

[0034] Further, the arrangement position of each text character in the text to be displayed can be determined, and the text character and the corresponding arrangement position are mapped and stored. The arrangement position is used as the identification information of the text character to identify the text character in the subsequent process.

[0035] 102. Add occupancy characters to each of the above text character groups to obtain multiple text segments, and print each text segment onto different layers to obtain multiple text layers.

[0036] Specifically, a certain number of occupancy characters can be added to each text character group to confuse web crawlers. Further, specific occupancy characters can be added to each text character group so that the text character group with the added occupancy characters can form a meaningful sentence, and this sentence is used as the text segment. Here, the text character group can be input into a pre-trained large language model so that the large language model can generate a sentence containing the above text characters based on the text characters in the text character group. Here, the characters added to the text character group are the occupancy characters.

[0037] As an example, if "我 (I)", "和 (and)", ", (comma)", "一 (one)", and "也 (also)" are the first text character group, then occupancy characters: "他 (he)", "没 (not)", "什 (what)", "么 (me)", "一 (one)", "直 (always)", "没 (not)", "在 (at)", "一 (one)", and "起 (together)" can be added to the first text character group so that the first text character group and the newly added occupancy characters form the text segment: "我和他没什么,一直也没在一起。 (I and he have nothing, and we haven't been together all the time.)". Further, for the second text character group and the third text character group, occupancy characters can be added respectively in the above manner to obtain multiple text segments corresponding to each text character group.

[0038] Furthermore, each text segment with occupied characters added is printed on different layers to obtain multiple text layers. The layer can be a text carrier for setting the text segment on the web page. In the actual working process, the layer with text can be set on the web page so that the text on the layer is displayed on the web page. Here, each text segment can be set on a different layer to obtain a text layer corresponding to each text segment, which is convenient for setting the text layer on the web page in the subsequent process.

[0039] 103. Mask the occupied characters in each of the text layers so that the occupied characters are invisible in the text layer.

[0040] Specifically, the linear-gradient property in Cascading Style Sheets (CSS) can be used to cover the occupied characters with the background color of the web page, where CSS is a markup language used to control the appearance and layout of a web page. It is used together with HyperText Markup Language (HTML), where HTML is responsible for defining the structure and content of a web page, while CSS is responsible for defining the style and presentation of these contents.

[0041] As an example, if the number of text layers is 3, the characters corresponding to the first text layer are "There is nothing between him and me, and we have never been together.", wherein the text characters are: "I", "and", "," "one" and "also", and the occupied characters are: "he", "no", "what", "what", "straight", "no", "in", ".", "one" and "up". Further, the characters corresponding to the second text layer are "Come back to my side, always thinking about splitting!", wherein the text characters are: "I", "of", "carve", "point", "cut" and "!", and the occupied characters are: "back", "to", "body", "side", "time", "think", "," "wear" and "want". Further, the characters corresponding to the third text layer are "Whenever I mention my home, my heart cannot be calm.", wherein the text characters are: "home", "garden", "not" and "can", and the occupied characters are: "every", "when", "mention", "to", "I", "of", "heart", "," "." "peace" and "quiet".

[0042] Furthermore, before occlusion, the three text layers are in the form of Figure 2 As shown, after masking each occupied character in the three text layers, the three text layers are obtained in the form of Figure 3 As shown, in Figure 2 as well as Figure 3 In the text layer, each line of text is a text layer.

[0043] 104. Overlay a plurality of the text layers to obtain a text display layer, and set the text display layer to the web page.

[0044] Specifically, use position: absolute to set the layout of the text layer to absolute layout, so that multiple text layers overlap, so that the text is visually seen as a line in the user's eyes. The specific effect is as follows Figure 4 shown.

[0045] The text processing method for webpage anti-crawler provided in the present embodiment firstly divides all the text characters of the text to be displayed on the webpage into a plurality of text character groups, wherein each text character group includes a plurality of text characters. Then, an occupied character for confusing the webpage crawler is added to each text character group, and the text character group with the occupied character is determined as a text segment. Further, each text segment is printed on different layers respectively to obtain a plurality of text layers. After that, the occupied characters in each text layer are shielded so that the occupied characters are in an invisible state in the text layer. Finally, the plurality of text layers are superimposed, and the text display layer formed after the superposition is set to the webpage, so that the text characters in the text display layer are in a visible state on the webpage, and the occupied characters in the text display layer are in an invisible state on the webpage because they are shielded, thereby not causing obstacles to the relevant personnel to read the text in the text display layer. As for web crawlers, they will crawl the text characters in the text display layer and the occupied characters that serve as obfuscation, making it impossible for the web crawlers to restore the to-be-displayed text that needs to be protected from web crawlers based on the text characters and occupied characters, thereby significantly improving the anti-crawler capabilities of the web page.

[0046] In an optional embodiment, dividing the plurality of text characters contained in the to-be-displayed text into a preset number of text character groups includes:

[0047] First, all the text characters contained in the text to be displayed are identified in the text to be displayed, and the character arrangement order of each text character in the text to be displayed is determined.

[0048] Specifically, the text to be displayed can be segmented based on a word segmenter to obtain each character in the text to be displayed. For example, if the text to be displayed is "My home and I cannot be separated for a moment!", the text to be displayed can be segmented into multiple text characters, including: "I", "and", "me", "of", "home", "garden", "," "one", "moment", "also", "not", "can", "divide", "cut" and "!".

[0049] Further, determine the character arrangement order of each text character after segmentation in the text to be displayed. As an example, the character arrangement order of the text character "and" in the text to be displayed is 3, and "3" can be set as the identification information of the text character "and". Further, the character arrangement order of other text characters can be determined in the above manner.

[0050] Then, divide all the text characters in the text to be displayed into the preset number of text character groups, where the character arrangement orders of the text characters included in each text character group are not consecutive.

[0051] As an example, starting from the character arrangement order with the smallest value, one text character can be extracted every other text character, and the extracted text characters are determined as the first text character group; further, for the remaining text characters, one text character can be extracted every other text character, and the extracted text characters are determined as the second text character group; further, the remaining text characters are determined as the third text character group, so that the character arrangement orders of the text characters included in each text character group are not consecutive.

[0052] The embodiments provided in this application can ensure that the text characters in each text character group are non-consecutive text characters in the text to be displayed, improve the confusion for web crawlers, and thus significantly improve the anti-crawler ability of the web page.

[0053] In an optional embodiment, occupancy characters are added to each text character group to obtain multiple text segments, including:

[0054] First, determine the total number of text characters of the text characters in the text to be displayed, and the number of text characters of the text characters in each text character group. Specifically, determine the total number of text characters of the text characters in the text to be displayed, and respectively determine the number of text characters of the text characters in each text character group.

[0055] As an example, the text to be displayed is "I and my homeland, not a moment can be separated!", where the total number of text characters of the text characters in the text to be displayed is 15; further, the first text character group is: "I", "and", ",", "one", and "also", and the number of text characters of the text characters in the first text character group is 5; further, the second text character group is: "my", "of", "moment", "separated", and "!", and the number of text characters of the text characters in the second text character group is 6; further, the third text character group is: "homeland", "not", and "can", and the number of text characters of the text characters in the third text character group is 4.

[0056] Then, calculate the character quantity difference between the total number of characters and the number of text characters in each of the text character groups, and determine the character addition quantity of the text character group as the character quantity difference corresponding to the text character group. Specifically, for each text character group, determine the character quantity difference between the number of text characters in this text character group and the total number of characters, obtain the character quantity difference corresponding to each text character group respectively, and determine the character quantity difference corresponding to each text character group as the character addition quantity of this text character group.

[0057] As an example, if the total number of text characters of the text to be displayed is 15, the number of text characters of the text characters in the first text character group is 5, the number of text characters of the text characters in the second text character group is 6, and the number of text characters of the text characters in the third text character group is 4, then the character quantity difference corresponding to the first text character group is 10, the character quantity difference corresponding to the second text character group is 9, and the character quantity difference corresponding to the third text character group is 11. Further, the character addition quantity of the first text character group is 10, the character addition quantity of the second text character group is 9, and the character addition quantity of the third text character group is 11.

[0058] Finally, add the occupied characters corresponding to the character addition quantity of the text character group to the text character group to obtain the text segment. Specifically, add the occupied characters corresponding to the character addition quantity of each text character group to each text character group to obtain multiple text segments, so that the number of characters in each text segment is the same as the total number of text characters in the text to be displayed.

[0059] The embodiments provided by this application can make the number of characters in each text segment the same as the total number of text characters in the text to be displayed, prevent web crawlers from crawling real text information, improve the confusion for web crawlers, and thus significantly improve the anti-crawler ability of the web page.

[0060] In an alternative embodiment, the adding the occupied characters corresponding to the character addition quantity of the text character group to the text character group to obtain the text segment includes:

[0061] First, determine the character arrangement order of each text character in the text character group in the text to be displayed; As an example, the text to be displayed is "I and my homeland can never be separated for a moment!", and a text character group is "home", "garden", "not" and "can", where the character arrangement order of "home" is five, the character arrangement order of "garden" is six, the character arrangement order of "can" is twelve, and the character arrangement order of "separated" is fourteen.

[0062] Then, arrange all the text characters into a text character queue in the order of increasing character arrangement order; as an example, the text character queue obtained by arranging "家", "园", "不", and "能" in the order of increasing character arrangement order is: "家", "园", "不", "能".

[0063] Finally, based on the character arrangement order of each text character in the text character queue, add the occupancy characters to the text character queue to obtain the text segment, so that the character arrangement order of each text character in the text segment is the same as the character arrangement order of the text character in the text to be displayed. Specifically, multiple occupancy characters can be added to the text character queue according to the character arrangement order of each text character in the text character queue, and it is ensured that after adding the occupancy characters to the text character queue to obtain the text segment, the character arrangement order of the text characters in the text segment is the same as the character arrangement order of the text characters in the text to be displayed.

[0064] As an example, a text character group is "家", "园", "不", and "能", where the character arrangement order of "家" is five, the character arrangement order of "园" is six, the character arrangement order of "能" is twelve, and the character arrangement order of "割" is fourteen. Occupancy characters can be added to the text character group to obtain the text segment: "每当提到家园,我的心不能平静。". Among them, the character arrangement order of "家" in the text segment is five, the character arrangement order of "园" in the text segment is six, the character arrangement order of "能" in the text segment is twelve, and the character arrangement order of "割" in the text segment is fourteen.

[0065] The embodiments provided in this application can ensure that the character arrangement order of text characters in the text segment is the same as the character arrangement order of text characters in the text to be displayed. During the subsequent overlay process of text layers, the situation where text characters in each text layer overlap can be avoided, ensuring the integrity of the text information set on the web page.

[0066] In an alternative embodiment, adding the occupancy characters to the text character queue to obtain the text segment includes:

[0067] First, determine the first text character arranged at the head of the text character queue as the first text character, determine the character arrangement order of the first text character as the first character arrangement order, determine the text character arranged at the end of the text character queue as the last text character, and determine the character arrangement order of the last text character as the last character arrangement order. As an example, a text character queue is "home", "garden", "not", and "can". Among them, "home" is the text character arranged at the head, that is, the first text character, and "can" is the text character arranged at the end, that is, the last text character. And the text to be displayed is "I and my home garden can't be separated for a moment!", so the character arrangement order of the text character "home" is 5, and 5 is determined as the first character arrangement order. Similarly, the character arrangement order of the text character "can" is 12, and 12 is determined as the last character arrangement order.

[0068] Then, based on the first character arrangement order, determine the first quantity of occupied characters added before the first text character, based on the last character arrangement order, determine the second quantity of occupied characters added after the last text character, and add the first quantity of occupied characters before the first text character and add the second quantity of occupied characters after the last text character. Among them, the value of the first quantity is equal to the difference between the value of the first character arrangement order and one, and the value of the second quantity is equal to the difference between the value of the total number of characters and the last character arrangement order.

[0069] As an example, the first text character is "home", and the first character arrangement order of this text character is 5, so 4 occupied characters are added before the first text character "home"; similarly, the last text character is "can", the last character arrangement order of this text character is 12, and the total number of text characters in the text to be displayed is 15, so 3 occupied characters are added after the last text character "home".

[0070] Finally, for every two adjacent text characters in the text character queue, based on the character arrangement orders of the two adjacent text characters, determine the character quantity of the occupied characters added between the two adjacent text characters, and add the occupied characters of the character quantity between the two adjacent text characters to obtain the text segment. Specifically, add occupied characters between every two adjacent text characters in the text character queue to obtain the text segment, where the character quantity of the occupied characters added between every two adjacent text characters is equal to the difference between the order difference between the character arrangement orders of the two text characters and one.

[0071] As an example, a text character queue is "家", "园", "不", and "能". "家" and "园" are two adjacent text characters, "园" and "不" are two adjacent text characters, and "不" and "能" are two adjacent text characters. Further, the character arrangement order of the text character "家" is 5, the character arrangement order of the text character "园" is 6, the character arrangement order of the text character "不" is 11, and the character arrangement order of the text character "能" is 12.

[0072] Further, the order difference between the character arrangement orders of "家" and "园" is 1. Subtracting one from the order difference gives a character quantity value of 0. Further, the order difference between the character arrangement orders of "园" and "不" is 5. Subtracting one from the order difference gives a character quantity value of 4. Further, the order difference between the character arrangement orders of "不" and "能" is 1. Subtracting one from the order difference gives a character quantity value of 0. Therefore, 4 occupied characters are added between "园" and "不" to obtain a text segment.

[0073] The embodiment provided by the present application can determine the quantity and position of the occupied characters added to the text character queue based on the character arrangement order of the text characters in the text character queue, so that the character arrangement order of each text character in the text segment is the same as the character arrangement order of the text character in the text to be displayed, avoiding the occurrence of overlapping of text characters in each text layer during the subsequent overlay process of the text layer, and enhancing the integrity of the text information that has performed web anti-crawler processing.

[0074] In an optional embodiment, the masking of the occupied characters in each text layer includes: determining the background color at the setting position of the text display layer set in the web page, and masking the occupied characters through the mask of the background color. Specifically, the background color of the page where the text display layer is about to be set can be determined, and the occupied characters are masked with the mask of this background color, and the mask is set on the top layer of the occupied characters, so that when the text display layer is set on the web page, the occupied characters are in an invisible state.

[0075] The embodiment provided by the present application can use a mask with the same color as the web page background color to mask the occupied characters, making the occupied characters invisible on the web page, while the web crawler can still crawl the occupied characters, improving the effect of web anti-crawler.

[0076] In an optional embodiment, the overlaying of the multiple text layers to obtain a text display layer includes:

[0077] First, each of the text layers is superimposed on each other, and it is determined whether the text characters on the text layer overlap with the mask; specifically, multiple text layers can be superimposed, and it is determined whether the text characters and any mask are in the same position on the web page. If the text characters and any mask are in the same position on the web page, it is determined that the text characters on the text layer overlap with the mask. Then, when the text characters overlap with the mask, the text characters are set on the top layer of the mask to obtain the text display layer.

[0078] The embodiment provided by the present application can set the text characters on the top layer of the mask to prevent the mask from blocking the text characters when the text layers are superimposed, thereby improving the display effect of the text display layer and improving the readability of the text while ensuring the anti-crawler capability of the web page.

[0079] The text processing method for webpage anti-crawler provided in this embodiment can add occupied characters to the text displayed on the webpage to change the form of the text, so that the webpage crawler cannot crawl the real text information, which has the effect of confusing the webpage crawler tool and enhancing the webpage anti-crawler ability of the text. At the same time, the added occupied characters are shielded to ensure that the added occupied characters will not affect the normal display of the text on the webpage, so that the webpage crawler cannot restore the to-be-displayed text that needs to be protected by webpage anti-crawler based on the text characters and the occupied characters, thereby significantly improving the anti-crawler ability of the webpage.

[0080] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. In addition, the numbers corresponding to the various steps in the above embodiments only serve as identification and are not used as a limitation on the order in which the steps are executed. The order in which the steps are executed in each embodiment can be set according to actual conditions.

[0081] Further, as Figure 1 The specific implementation of the method shown in the embodiment provides a text processing device for web page anti-crawler, such as Figure 5 As shown, the device includes: a text acquisition module 51, a character adding module 52, a character shielding module 53, and a text overlay module 54.

[0082] The text acquisition module 51 is used to acquire the text to be displayed and divide the multiple text characters contained in the text to be displayed into a preset number of text character groups;

[0083] The character adding module 52 can be used to add occupied characters to each of the text character groups to obtain multiple text segments, and to print each of the text segments on different layers to obtain multiple text layers;

[0084] A character shielding module 53, which can be used to shield the occupied characters in each of the text layers so that the occupied characters are invisible in the text layer;

[0085] The text overlay module 54 can be used to overlay a plurality of the text layers to obtain a text display layer, and set the text display layer to the web page.

[0086] In a specific application scenario, the text acquisition module 51 can be specifically used to identify all the text characters contained in the text to be displayed, and determine the character arrangement order of each text character in the text to be displayed; divide all the text characters in the text to be displayed into the preset number of text character groups, wherein the character arrangement order of the text characters contained in each text character group is discontinuous.

[0087] In a specific application scenario, the character adding module 52 can be specifically used to determine the total number of text characters in the text to be displayed, and the number of text characters in each of the text character groups; calculate the difference in the number of characters between the total number of characters and the number of text characters in each of the text character groups, and determine the difference in the number of characters corresponding to the text character group as the number of characters added to the text character group; add the occupied characters corresponding to the number of characters added to the text character group to obtain the text segment.

[0088] In a specific application scenario, the character adding module 52 can also be used to determine the character arrangement order of each text character in the text character group in the text to be displayed; arrange all the text characters into a text character queue in ascending order of the character arrangement order; based on the character arrangement order of each text character in the text character queue, add the occupied characters to the text character queue to obtain the text segment, so that the character arrangement order of each text character in the text segment in the text segment is the same as the character arrangement order of the text character in the text to be displayed.

[0089] In a specific application scenario, the character adding module 52 can also be used to determine the text character arranged in the first position in the text character queue as the first text character, and determine the character arrangement order of the first text character as the first character arrangement order, and determine the text character arranged in the last position as the last text character, and determine the character arrangement order of the last text character as the last character arrangement order; determine a first number of occupied characters added before the first text character based on the first character arrangement order, determine a second number of occupied characters added after the last text character based on the last character arrangement order, add the first number of occupied characters before the first text character, and add the second number of occupied characters after the last text character; determine the number of occupied characters added between the two adjacent text characters based on the character arrangement order of the two adjacent text characters, and add the occupied characters of the character number between the two adjacent text characters to obtain the text segment.

[0090] In a specific application scenario, the character shielding module 53 can be specifically used to determine the background color at the setting position of the text display layer in the webpage, and shield the occupied characters through the mask of the background color.

[0091] In a specific application scenario, the text overlay module 54 can be specifically used to overlay each text layer on top of each other and determine whether the text characters on the text layer overlap with the mask; when the text characters overlap with the mask, the text characters are set on the top layer of the mask to obtain the text display layer.

[0092] It should be noted that for other corresponding descriptions of the functional units involved in the text processing device for webpage anti-crawler provided in this embodiment, please refer to Figure 1 The corresponding description in will not be repeated here.

[0093] Based on the above Figure 1 The method shown in the embodiment also provides a storage medium on which a computer program is stored. When the program is executed by a processor, the above-mentioned Figure 1 The text processing method for web page anti-crawler is shown.

[0094] Based on this understanding, the technical solution of the present application can be embodied in the form of a software product. The software product to be identified can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.), including a number of instructions for enabling a computer (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each implementation scenario of the present application.

[0095] Based on the above Figure 1 The method shown, and Figure 5 In order to achieve the above-mentioned purpose, the text processing device embodiment of the webpage anti-crawler is shown. Figure 6 As shown, this embodiment also provides a computer for executing a text processing method for webpage anti-crawler, which can be a personal computer, a server, a smart phone, a tablet computer, a smart watch, or other network devices, etc. The computer includes a storage medium and a processor; the storage medium is used to store a computer program and an operating system; the processor is used to execute the computer program to implement the above-mentioned Figure 1 The method shown.

[0096] Optionally, the computer may further include an internal memory, a communication interface, a network interface, a camera, a radio frequency (RF) circuit, a sensor, an audio circuit, a WI-FI module, a display, an input device such as a keyboard, etc. Optionally, the communication interface may also include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface, a wireless interface (such as a WI-FI interface), etc.

[0097] Those skilled in the art will appreciate that the computer structure for identifying an operation action provided in this embodiment does not constitute a limitation on the computer, and may include more or fewer components, or a combination of certain components, or different arrangements of components.

[0098] The storage medium may also include an operating system and a network communication module. The operating system is a program that manages the above-mentioned computer hardware and software resources to be identified, and supports the operation of information processing programs and other software and / or programs to be identified. The network communication module is used to realize communication between components inside the storage medium, and communication with other hardware and software in the information processing computer.

[0099] Through the description of the above implementation methods, those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform, or by hardware. By applying the technical solution of the present application, first, the text to be displayed is obtained, and the multiple text characters contained in the text to be displayed are divided into a preset number of text character groups; then, occupied characters are added to each of the text character groups to obtain multiple text segments, and each of the text segments is printed on different layers to obtain multiple text layers; then, the occupied characters in each of the text layers are blocked to make the occupied characters invisible in the text layer; finally, multiple text layers are superimposed to obtain a text display layer, and the text display layer is set to the web page. Compared with the prior art, the anti-crawler capability of the web page can be significantly improved.

[0100] Those skilled in the art will appreciate that the accompanying drawings are only schematic diagrams of a preferred implementation scenario, and the modules or processes in the accompanying drawings are not necessarily necessary for implementing the present application. Those skilled in the art will appreciate that the modules in the devices in the implementation scenario can be distributed in the devices of the implementation scenario according to the description of the implementation scenario, or can be changed accordingly and located in one or more devices different from the present implementation scenario. The modules of the above-mentioned implementation scenario can be combined into one module, or can be further split into multiple submodules.

[0101] The above serial numbers of this application are only for description and do not represent the advantages and disadvantages of the implementation scenarios. The above disclosure is only a few specific implementation scenarios of this application, but this application is not limited to them, and any changes that can be thought of by technicians in this field should fall within the scope of protection of this application.

Claims

1. A webpage anti-crawler text processing method, used for performing webpage anti-crawler processing on text set on a webpage, characterized in that: The method comprises: Acquire a text to be displayed, and divide a plurality of text characters contained in the text to be displayed into a preset number of text character groups; Adding occupied characters to each of the text character groups to obtain a plurality of text segments, and printing each of the text segments on a different layer to obtain a plurality of text layers; Masking the occupied characters in each of the text layers so that the occupied characters are invisible in the text layer; A plurality of the text layers are superimposed to obtain a text display layer, and the text display layer is set at the web page.

2. The method according to claim 1, characterized in that The step of dividing the plurality of text characters contained in the to-be-displayed text into a preset number of text character groups includes: Identifying all the text characters contained in the text to be displayed in the text to be displayed, and determining the character arrangement order of each text character in the text to be displayed; All the text characters in the to-be-displayed text are divided into the preset number of text character groups, wherein the character arrangement order of the text characters contained in each of the text character groups is discontinuous.

3. The method according to claim 1, characterized in that The step of adding occupied characters to each of the text character groups to obtain a plurality of text segments includes: Determining the total number of text characters in the text to be displayed, and the number of text characters in each of the text character groups; Calculating the difference between the total number of characters and the number of text characters in each of the text character groups, and determining the difference in the number of characters corresponding to the text character group as the number of characters added to the text character group; The occupied characters corresponding to the character addition quantity of the text character group are added to the text character group to obtain the text segment.

4. The method according to claim 3, characterized in that The step of adding the occupied characters corresponding to the character addition number of the text character group to the text character group to obtain the text segment comprises: Determine the character arrangement order of each of the text characters in the text character group in the text to be displayed; Arranging all of the text characters into a text character queue in ascending order of the character arrangement sequence; Based on the character arrangement order of each of the text characters in the text character queue, the occupied characters are added to the text character queue to obtain the text segment, so that the character arrangement order of each of the text characters in the text segment in the text segment is the same as the character arrangement order of the text characters in the text to be displayed.

5. The method according to claim 4, characterized in that The step of adding the occupied characters to the text character queue to obtain the text segment comprises: Determine the text character arranged at the first position in the text character queue as the first text character, and determine the character arrangement order of the first text character as the first character arrangement order, and determine the text character arranged at the last position in the text character queue as the last text character, and determine the character arrangement order of the last text character as the last character arrangement order; Determine a first number of occupied characters to be added before the first text character based on the first character arrangement order, determine a second number of occupied characters to be added after the last text character based on the last character arrangement order, and add the first number of occupied characters before the first text character and add the second number of occupied characters after the last text character; Based on the character arrangement order of two adjacent text characters, the number of occupied characters added between the two adjacent text characters is determined, and the occupied characters of the number of characters are added between the two adjacent text characters to obtain the text segment.

6. The method according to claim 1, characterized in that The step of masking the occupied characters in each of the text layers comprises: The background color of the setting position of the text display layer in the webpage is determined, and the occupied characters are shielded by a mask of the background color.

7. The method according to claim 6, characterized in that The step of superimposing the plurality of text layers to obtain a text display layer comprises: superimposing each of the text layers on each other, and determining whether the text characters on the text layer overlap with the mask; When the text characters overlap with the mask, the text characters are set on the top layer of the mask to obtain the text display layer.

8. A text processing device for webpage anti-crawler, characterized in that: The device comprises: A text acquisition module, used for acquiring a text to be displayed, and dividing a plurality of text characters contained in the text to be displayed into a preset number of text character groups; A character adding module, used for adding occupied characters to each of the text character groups to obtain a plurality of text segments, and printing each of the text segments on different layers to obtain a plurality of text layers; A character shielding module, used for shielding the occupied characters in each of the text layers, so that the occupied characters are invisible in the text layer; The text overlay module is used to overlay a plurality of the text layers to obtain a text display layer, and set the text display layer to the web page.

9. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.