CN109413451B - Bullet screen data verification method and device and terminal - Google Patents

Bullet screen data verification method and device and terminal Download PDF

Info

Publication number
CN109413451B
CN109413451B CN201811160420.0A CN201811160420A CN109413451B CN 109413451 B CN109413451 B CN 109413451B CN 201811160420 A CN201811160420 A CN 201811160420A CN 109413451 B CN109413451 B CN 109413451B
Authority
CN
China
Prior art keywords
preset
bullet screen
character
screen data
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811160420.0A
Other languages
Chinese (zh)
Other versions
CN109413451A (en
Inventor
张磊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Douyu Network Technology Co Ltd
Original Assignee
Wuhan Douyu Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuhan Douyu Network Technology Co Ltd filed Critical Wuhan Douyu Network Technology Co Ltd
Priority to CN201811160420.0A priority Critical patent/CN109413451B/en
Publication of CN109413451A publication Critical patent/CN109413451A/en
Application granted granted Critical
Publication of CN109413451B publication Critical patent/CN109413451B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/235Processing of additional data, e.g. scrambling of additional data or processing content descriptors
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/435Processing of additional data, e.g. decrypting of additional data, reconstructing software from modules extracted from the transport stream
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/47End-user applications
    • H04N21/478Supplemental services, e.g. displaying phone caller identification, shopping application
    • H04N21/4788Supplemental services, e.g. displaying phone caller identification, shopping application communicating with other users, e.g. chatting

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • General Engineering & Computer Science (AREA)
  • User Interface Of Digital Computer (AREA)
  • Document Processing Apparatus (AREA)

Abstract

The embodiment of the invention discloses a bullet screen data checking method, a bullet screen data checking device and a terminal. The method comprises the following steps: acquiring target bullet screen data of a preset character string structure; calling a character verification function in a bullet screen data object for storing target bullet screen data, and performing character verification on a first character and a last character in the target bullet screen data; if the character verification is successful, calling a character string conversion function in the bullet screen data object when the preset identifier only comprises one preset character, and determining the number of the preset identifiers in the target bullet screen data; when the preset identifier comprises at least two preset characters, calling a character string segmentation function in the bullet screen data object, and determining the number of the preset identifiers in the target bullet screen data; and if the number of the preset identifiers meets the preset verification condition, determining that the target bullet screen data is verified successfully. Through the technical scheme of the embodiment of the invention, the integrity of the bullet screen data can be verified, so that the bullet screen data can be normally analyzed.

Description

Bullet screen data verification method and device and terminal
Technical Field
The embodiment of the invention relates to the technical field of barrage, in particular to a method, a device and a terminal for checking barrage data.
Background
With the rapid development of intelligent terminals, various application software is developed and applied to the intelligent terminals. Some application software such as live broadcast software and video playing software often have barrage functions of barrage receiving, parsing, pushing and the like. In the process of developing the application software, the bullet screen data issued by the server needs to be subjected to a relevant test to determine whether the bullet screen function normally operates.
At present, in application software development based on an Android operating system, after a server constructs and completes bullet screen data according to a preset bullet screen protocol, the constructed bullet screen data is often directly issued to a client, and when the client receives the bullet screen data, the client also directly analyzes and distributes the bullet screen data.
Therefore, in the existing bullet screen data issuing process and receiving process, the server and the client do not perform any check on bullet screen data, so that when the bullet screen data has abnormal conditions, the bullet screen testing process is wrong, even the client is crashed, and the like, and the bullet screen testing efficiency is seriously influenced.
Disclosure of Invention
The embodiment of the invention provides a bullet screen data checking method, a bullet screen data checking device and a bullet screen data checking terminal, which are used for checking the integrity of bullet screen data, so that the bullet screen data can be normally analyzed, and the problems that a client terminal is crashed and the like are avoided.
In a first aspect, an embodiment of the present invention provides a method for checking bullet screen data, including:
acquiring target bullet screen data of a preset character string structure, wherein the preset character string structure comprises at least one preset identifier;
calling a character verification function in a bullet screen data object for storing the target bullet screen data, and performing character verification on the first character and the last character in the target bullet screen data;
if the character verification is successful, calling a character string conversion function in the bullet screen data object when the preset identifier only comprises one preset character, converting the target bullet screen data into a target character array, and determining the number of the preset identifiers in the target bullet screen data according to the target character array;
when the preset identifier comprises at least two preset characters, calling a character string segmentation function in the bullet screen data object, segmenting the target bullet screen data into character string arrays, and determining the number of the preset identifiers in the target bullet screen data according to the array length of the character string arrays;
and if the number of the preset identifiers meets a preset verification condition, determining that the target bullet screen data is verified successfully.
In a second aspect, an embodiment of the present invention further provides a device for checking bullet screen data, including:
the system comprises a target barrage data acquisition module, a target barrage data acquisition module and a target barrage data acquisition module, wherein the target barrage data acquisition module is used for acquiring target barrage data of a preset character string structure, and the preset character string structure comprises at least one preset identifier;
the character verification module is used for calling a character verification function in a bullet screen data object for storing the target bullet screen data and performing character verification on the first character and the last character in the target bullet screen data;
the first preset identifier quantity determining module is used for calling a character string conversion function in the bullet screen data object when the preset identifier only comprises one preset character if the character verification is successful, converting the target bullet screen data into a target character array, and determining the quantity of the preset identifiers in the target bullet screen data according to the target character array;
the second preset identifier quantity determining module is used for calling a character string segmentation function in the bullet screen data object when the preset identifier comprises at least two preset characters, segmenting the target bullet screen data into character string arrays, and determining the quantity of the preset identifiers in the target bullet screen data according to the array length of the character string arrays;
and the preset identifier number checking module is used for determining that the target bullet screen data is successfully checked if the number of the preset identifiers meets a preset checking condition.
In a third aspect, an embodiment of the present invention further provides a terminal, where the terminal includes:
one or more processors;
a memory for storing one or more programs;
when the one or more programs are executed by the one or more processors, the one or more processors implement the method for checking bullet screen data provided by any embodiment of the invention.
The method comprises the steps of storing target bullet screen data with a preset character string structure in a bullet screen data object, calling a character verification function in the bullet screen data object, and performing character verification on a first character and a last character in the target bullet screen data; if the character verification is successful, selecting an optimal determination mode of the number of the preset identifiers according to the number of the preset characters contained in the preset identifiers so as to improve the verification efficiency. Specifically, when the preset identifier only comprises one preset character, calling a character string conversion function in the bullet screen data object, converting the target bullet screen data into a target character array, and determining the number of the preset identifiers in the target bullet screen data according to the target character array; when the preset identifier comprises at least two preset characters, calling a character string segmentation function in the bullet screen data object, segmenting the target bullet screen data into character string arrays, and determining the number of the preset identifiers in the target bullet screen data according to the array length of the character string arrays. And when the number of the preset characters meets the preset verification condition, determining that the target bullet screen data is verified successfully. Through adopting above-mentioned technical scheme, the target barrage data to predetermineeing the character string structure has carried out the integrality check-up to after target barrage data check-up succeeds, can carry out normal analysis to target barrage data, and then avoided leading to the customer end to appear the scheduling problem of system collapse because of barrage data is unusual, improved barrage efficiency of software testing.
Drawings
Fig. 1 is a flowchart of a method for checking bullet screen data according to an embodiment of the present invention;
fig. 2 is a flowchart of a method for checking bullet screen data according to a second embodiment of the present invention;
fig. 3 is a flowchart of a method for checking bullet screen data according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of a bullet screen data checking apparatus according to a fourth embodiment of the present invention;
fig. 5 is a schematic structural diagram of a terminal according to a fifth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Example one
Fig. 1 is a flowchart of a method for checking bullet screen data according to an embodiment of the present invention, which is applicable to integrity checking of bullet screen data of a preset character string structure, and particularly applicable to an application scenario in which bullet screen data is generated in a bullet screen server according to a preset bullet screen protocol and then checked, and also applicable to an application scenario in which bullet screen data issued by the bullet screen server is checked in an Android client. The method can be executed by a bullet screen data checking device, the device can be realized in a software and/or hardware mode, and can be integrated in a bullet screen server or a terminal with a bullet screen function and loaded with an Android system, such as an intelligent terminal like a smart phone, a tablet personal computer, a smart television or a notebook computer. The method specifically comprises the following steps:
s110, target bullet screen data of a preset character string structure are obtained, wherein the preset character string structure comprises at least one preset identifier.
The bullet screen data may be data of a String type obtained by encapsulating the bullet screen parameter information according to a preset bullet screen protocol. The preset bullet screen protocol can be preset according to actual conditions and user requirements and is used for stipulating a transmission data structure of bullet screen data so that data transmission can be carried out between a bullet screen server and a client. The preset barrage protocol may specify one or more data structures. The predetermined string structure may be a data structure specified in a predetermined bullet screen protocol. The preset character string structure corresponds to a preset bullet screen protocol. The target barrage data may be barrage data of a preset character string structure to be checked. The preset identifier is a character or a character string having a specific meaning in a preset character string structure specified based on a preset bullet screen protocol. The preset identifier may include one preset character or a plurality of preset characters, where the preset character may be a predefined number, letter, or special symbol. Illustratively, the preset identifier may be a preset separator in the preset character string structure that divides each key-value pair information, and the preset separator may be, but is not limited to, a single slash "\", "/", a double slash "\\ \ and"// ", and the like. The preset character string structure in this embodiment may include only one preset identifier, or may include two or more different preset identifiers; the number of the types of the preset identifiers in the preset character string structure can be predetermined according to a preset bullet screen protocol.
Optionally, S110 includes: acquiring bullet screen data to be verified and a bullet screen data identifier to be verified corresponding to the bullet screen data to be verified; matching the data identification to be verified with the data identification in the identification set corresponding to the preset character string structure; and if the matching is successful, determining the bullet screen data to be verified as target bullet screen data.
The bullet screen data to be verified can be bullet screen data of any character string structure obtained after the bullet screen parameter information is packaged according to a preset bullet screen protocol. And each bullet screen data to be verified corresponds to a data identifier to be verified. The to-be-verified data identification is used for uniquely identifying the bullet screen data to be verified, so that the data structure of the bullet screen data to be verified can be determined through the to-be-verified data identification. The identifier set corresponding to the preset character string structure may include: the data structure is a data identifier corresponding to all bullet screen data of a preset character string structure.
Specifically, if a plurality of data structures are specified by a preset bullet screen protocol, when certain bullet screen data is generated, whether the data structure of the generated bullet screen data is a preset character string structure or not can be detected in advance, if so, a data identifier corresponding to the bullet screen data is added to an identifier set corresponding to the preset character string structure, and therefore the data identifier corresponding to the bullet screen data of the generated data structure, which is the preset character string structure, is added to the identifier set, and subsequent verification operation is performed. After the to-be-verified data identifier corresponding to the to-be-verified bullet screen data is obtained, the to-be-verified data identifier and the data identifier in the identifier set corresponding to the preset character string structure can be matched one by one, if the to-be-verified data identifier is successfully matched with any data identifier in the identifier set, the data structure of the to-be-verified bullet screen data is the preset character string structure, and at the moment, the to-be-verified bullet screen data can be determined as target bullet screen data so that integrity verification can be conducted on the target bullet screen data. If the matching between the to-be-verified data identifier and each data identifier in the identifier set fails, it is indicated that the data structure of the bullet screen data to be verified is not the preset character string structure, and at this time, identifier matching can be performed on the next bullet screen data to be verified until the target bullet screen data of the preset character string structure is obtained.
And S120, calling a character verification function in the bullet screen data object for storing the target bullet screen data, and performing character verification on the first character and the last character in the target bullet screen data.
Wherein, the bullet screen data object is an object for storing target bullet screen data. The target barrage data in this embodiment is a String type data, so that the barrage data object is a String object. The character verification function may be a predefined function for verifying the first and last characters in the target bullet screen data.
Specifically, if the first character in the accurate and complete bullet screen data is determined to be the first preset character and the last character in the bullet screen data is determined to be the second preset character according to the preset character string structure, whether the first character in the target bullet screen data is the first preset character and whether the last character in the target bullet screen data is the second preset character can be verified by calling a character verification function in the bullet screen data object. Exemplarily, a first preset character is taken as a function input parameter, a character verification function is called, whether a first character in the target bullet screen data is the first preset character or not is detected, if not, the first character verification fails, that is, the target bullet screen data is incomplete data, that is, unqualified data, and at this time, the target bullet screen data can be directly determined to fail to be verified; if the first character in the target bullet screen data is detected to be the first preset character, the first character is successfully verified, at this moment, the second preset character can be used as a function input parameter, a character verification function is called, whether the last character in the target bullet screen data is the second preset character is detected, if yes, the first character and the last character in the target bullet screen data are both legal, and at this moment, the character verification can be determined to be successful; if not, the target bullet screen data is indicated to be incomplete data, and at the moment, the failure of the verification of the target bullet screen data can be directly determined.
S130, if the character verification is successful, when the preset identifier only comprises one preset character, calling a character string conversion function in the bullet screen data object, converting the target bullet screen data into a target character array, and determining the number of the preset identifiers in the target bullet screen data according to the target character array.
The character string conversion function is predefined and is used for converting the target bullet screen data into a function of a character array. The character sequence in the target character array is consistent with the character sequence in the target bullet screen data. If the bullet screen data object is marked as danmuStr, the string conversion function in the bullet screen data object may be: tocarrray (), so that the target bullet screen data stored in the bullet screen data object danmuster can be converted into a target character array. Exemplarily, it is assumed that the target bullet screen data stored in the bullet screen data object danmuStr is: abcd, by calling danmuStr char [ ] ═ danmuStr. tochrarray (), saves the object of each subscript of the bullet screen data object danmuStr in danmuStr char [ ], i.e. the information in danmuStr char [ ]: { 'a', 'b', 'c','d' }.
Specifically, when it is detected that the preset identifier includes only one preset character, the number of the preset identifier in the target bullet screen data can be determined by using a conversion array mode, so as to improve the calculation speed. For example, when the number of the preset identifiers is determined according to the target character array, each character element in the target character array can be compared with the preset identifiers at one time; the character elements can also be compared with the preset identifiers in each cycle in a cycle traversal mode, so that the calculation speed is improved.
S140, when the preset identifier comprises at least two preset characters, calling a character string segmentation function in the bullet screen data object, segmenting the target bullet screen data into character string arrays, and determining the number of the preset identifier in the target bullet screen data according to the array length of the character string arrays.
The character string segmentation function is predefined and is used for segmenting the target bullet screen data into a function of a character string array. For example, if the bullet screen data object is marked as danmuStr, the string segmentation function in the bullet screen data object may be: property () to divide the target bullet screen data stored in bullet screen data object danmust into an array of strings. The array length of the string array refers to the number of elements in the string array.
Specifically, when it is detected that the preset identifier includes at least two preset characters, the number of the preset identifiers in the target bullet screen data can be determined by means of character string segmentation, so that the calculation speed is increased. In this embodiment, a preset identifier may be used as an input parameter of the string segmentation function, the string segmentation function is called, the target bullet screen data in the bullet screen data object is segmented by the preset identifier, and a plurality of string data obtained after segmentation form a string array. Exemplarily, it is assumed that the target bullet screen data stored in the bullet screen data object danmuStr is: if the preset identifier is bc, storing character string data obtained by dividing the target bullet screen data by bc into a character string array splitSrtAlrray by calling splitSrtAlrray ═ danmusStr. { "ad", "e", "de" }. According to the length attribute of the character string array, the array length of the character string array, namely the number of the divided character string data, can be directly obtained. Illustratively, the array length of the string array splitstartay may be obtained by calling splitstartay. The operation relation between the array length of the character string array corresponding to the accurate and complete bullet screen data and the number of the preset identifiers can be predetermined according to the preset character string structure, so that the number of the preset identifiers in the target bullet screen data can be calculated based on the operation relation.
It should be noted that, when the preset identifier includes only one preset character, if the number of the preset identifier is calculated by using a character string segmentation method, since the system function memory of the character string segmentation function occupies a large space and has low operation efficiency, when the method of converting the array is used, only each character in the target bullet screen data needs to be matched with the preset identifier, and thus when the preset identifier includes only one preset character, the number of the preset identifier can be determined more quickly by using the method of converting the array. When the preset identifier includes N (N is greater than or equal to 2) preset characters, if the number of the preset identifier is determined by using an array conversion method, it is necessary to acquire a character string composed of every N adjacent characters in the target bullet screen data, and match each character string with the preset identifier. Therefore, the same character in the target bullet screen data can be judged for multiple times by using the array conversion mode, so that the calculation speed is greatly reduced, and the number of the preset identifiers can be rapidly determined by using the character string segmentation mode when the preset identifiers comprise at least two preset characters.
If the preset character string structure in this embodiment includes multiple preset identifiers, for each preset identifier, the number of the included preset characters needs to be detected, and when the number of the preset characters is one, the number of the preset identifiers in the target bullet screen data is determined by using the method provided in step S130; when the number of the preset characters is two or more, the number of the preset identifiers in the target bullet screen data is determined by using the method provided in step S140, so that the number of each preset identifier in the target bullet screen data can be determined quickly.
S150, if the number of the preset identifiers meets the preset verification condition, it is determined that the target bullet screen data is verified successfully.
The preset check condition refers to a condition that the number of the preset identifiers needs to meet when the bullet screen data is complete. For example, if the accurate number of the preset identifiers in the target bullet screen data obtained in advance is 10, the preset checking condition may be: the number of the preset identifiers in the target bullet screen data is 10.
Specifically, if the number of the preset identifiers meets the preset check condition, it is indicated that the target bullet screen data is a complete piece of data and can be normally analyzed, and at this time, it can be determined that the target bullet screen data is successfully verified. If the number of the preset identifiers does not meet the preset detection condition, the target bullet screen data is judged to be illegal data, and at the moment, the target bullet screen data is determined to fail to be verified.
It should be noted that, in this embodiment, the functions provided in steps S120 to S150 may be packaged into a bullet screen check function, so that the bullet screen data object only needs to be used as an input object of the bullet screen check function, and a check process of the target bullet screen data can be implemented by calling the bullet screen check function, so that bullet screen check is more convenient. Illustratively, the bullet screen check function may be defined as: public static Boolean checkDanmInfo (String danmuStr). Wherein, the checkDanmInfo is the function name of the bullet screen check function, danmuStr is the bullet screen data object of the String type, and the return value of the bullet screen check function checkDanmInfo is an object of Boolean type. If the target bullet screen data is successfully checked, the bullet screen checking function checkDanmInfo can return true by calling return true, and if the target bullet screen data is unsuccessfully checked, the bullet screen checking function checkDanmInfo can call return false. The bullet screen check function checkdanmninfo has public authority modifier public and static type modifier static, so that the bullet screen check function can be called directly through the class, and the convenience of calling the bullet screen check function is improved.
Optionally, before the bullet screen server issues the target bullet screen data to the Android client, the bullet screen data verification method provided by the embodiment may be used for verifying, and after the target bullet screen data is successfully verified, the target bullet screen data is issued, so that the target bullet screen data issued by the bullet screen server is accurate and complete. After receiving the delivered target bullet screen data, the Android client can perform secondary verification by using the method for verifying the bullet screen data provided by the embodiment, and after the target bullet screen data is successfully verified, the target bullet screen data is analyzed, so that the problems that the client is crashed due to abnormal bullet screen data and the like can be avoided, and the bullet screen testing efficiency is improved.
According to the technical scheme of the embodiment, after target bullet screen data with a preset character string structure is stored in a bullet screen data object, a character verification function in the bullet screen data object is called, and character verification is carried out on first characters and last characters in the target bullet screen data; if the character verification is successful, selecting an optimal determination mode of the number of the preset identifiers according to the number of the preset characters contained in the preset identifiers so as to improve the verification efficiency. Specifically, when the preset identifier only comprises one preset character, calling a character string conversion function in the bullet screen data object, converting the target bullet screen data into a target character array, and determining the number of the preset identifiers in the target bullet screen data according to the target character array; when the preset identifier comprises at least two preset characters, calling a character string segmentation function in the bullet screen data object, segmenting the target bullet screen data into character string arrays, and determining the number of the preset identifiers in the target bullet screen data according to the array length of the character string arrays. And when the number of the preset characters meets the preset verification condition, determining that the target bullet screen data is verified successfully. Through adopting above-mentioned technical scheme, the target barrage data to predetermineeing the character string structure has carried out the integrality check-up to after target barrage data check-up succeeds, can carry out normal analysis to target barrage data, and then avoided leading to the customer end to appear the scheduling problem of system collapse because of barrage data is unusual, improved barrage efficiency of software testing.
Example two
Fig. 2 is a flowchart of a method for checking bullet screen data according to a second embodiment of the present invention, and this embodiment describes in detail a checking process of "target bullet screen data with a preset character string structure being a first preset character string structure" on the basis of the second embodiment. Wherein explanations of the same or corresponding terms as those of the above embodiments are omitted.
Referring to fig. 2, the method for verifying bullet screen data provided by this embodiment includes the following steps:
s210, target bullet screen data of a first preset character string structure are obtained.
Wherein, the first preset character string structure is: the method comprises the steps of taking a preset start character as a first character, dividing each key value pair information by a first preset identifier, connecting the key information and the value information in the key value pair information by a second preset identifier, and taking a preset end character as a last character, wherein the value information does not contain the second preset identifier. In this embodiment, the first preset character string structure includes two preset identifiers, which are a first preset identifier and a second preset identifier, respectively, and the first preset identifier includes one preset character and the second preset identifier includes two preset characters.
Illustratively, the preset start symbol, the first preset identifier, the second preset identifier and the preset end symbol are all characters which are set in advance according to actual conditions, and the preset start symbol, the first preset identifier, the second preset identifier and the preset end symbol are different characters from each other. In this embodiment, the preset start symbol may be, but is not limited to, a left curly brace "{", a left curly brace "(" or a left curly brace "[". to increase the discrimination degree with the content of the character string body, preferably, the left curly brace "{". the first preset identifier may be, but is not limited to, a slash "\\" or "/". the second preset identifier may be, but is not limited to, "@ ═ or" ═ ", and the preset end symbol may be, but is not limited to, a right curly brace" } ", a right curly brace") "or a right curly brace" ] ", preferably, a right curly brace" } ".
Specifically, a plurality of key value pair information are included between a first character and a last character in target bullet screen data of a first preset character string structure, every two pieces of key value pair information are divided by a first preset identifier, key information and value information in each piece of key value pair information are connected by a second preset identifier, and each piece of value information does not include the second preset identifier. The key-value pair information of the present embodiment may include english characters and/or chinese characters. The number of key-value pair information in the first preset string structure is not limited. Illustratively, the target barrage data of the first preset character string structure may be:
{type@=uenter/rid@=104838/uid@=20080138/wgei@=0/}
the target bullet screen data takes "{" as a preset start symbol, takes "/" as a first preset identifier, takes "@ ═ as a second preset identifier, takes" } "as a preset end symbol, and comprises four key value pair information. The key information in the first key-value pair information is "type", and the corresponding value information is "uenter"; the key information in the second key-value pair information is "rid", and the corresponding value information is "104838"; the key information in the third key value pair information is "uid", and the corresponding value information is "20080138"; the key information in the fourth key-value pair information is "wgei", and the corresponding value information is "0".
S220, calling a first character verification function, and detecting whether the first character in the target bullet screen data is a preset start character or not.
The first character verification function is a predefined function used for verifying the first character in the target bullet screen data. Illustratively, the bullet screen data object is marked as danmuster, and if the preset start character is "{", then the first character verification function is called to be danmuster.
Specifically, after the first character verification function is called, if it is detected that the first character in the target bullet screen data is not the preset start character, it indicates that the first character verification fails, that is, the target bullet screen data is incomplete data, that is, unqualified data, and at this time, it may be directly determined that the target bullet screen data fails to be verified. If the first character in the detected target bullet screen data is the preset start character, the verification of the first character is successful, and at the moment, the subsequent verification operation can be continued.
And S230, if the first character is a preset start character, calling a second character verification function, detecting whether the last character in the target bullet screen data is a preset end character, and if the last character is the preset end character, determining that the character verification is successful.
The second character verification function is a predefined function for verifying the last character in the target bullet screen data. Illustratively, the bullet screen data object is marked as danmuStr, and if the preset end symbol is "}", a second character verification function may be called danmuStr. endwith ("}") to detect whether a last character in the target bullet screen data in the bullet screen data object danmuStr is "}".
Specifically, when the first character of the target bullet screen data is a preset start character, the second character verification function can be continuously called, whether the last character in the target bullet screen data is a preset end character or not is detected, if yes, the first character and the last character in the target bullet screen data are both legal, and at this time, the character verification can be determined to be successful; if not, the target bullet screen data is indicated to be incomplete data, and at the moment, the failure of the verification of the target bullet screen data can be directly determined.
S240, if the character verification is successful, calling a character string conversion function in the bullet screen data object, and converting the target bullet screen data into a target character array.
And S250, matching each character element in the target character array with a first preset identifier, and determining the number of the first preset identifiers in the target bullet screen data according to the matching result.
Specifically, the present embodiment may quickly determine the number of the first preset identifiers by performing a loop traversal on the target character array. Illustratively, the process of loop traversal may be: taking a first character element in the target character array as a current character element; matching the current character element with a first preset identifier, and if the matching is successful, performing self-adding operation on a preset first global variable, namely adding 1 to the first global variable; and updating the next character element of the current character element into the current character element, and returning to execute the operation of matching the current character element with the first preset identifier until the current character element is the last character element in the target character array. The first global variable is used for storing the number of first preset identifiers in the target bullet screen data. The first global variable may be defined as: private int split count1 ═ 0. Wherein, the splitCount1 is the name of the first global variable, and the first global variable splitCount1 is an integer variable with an initial value of 0. The first global variable splitCount1 has a private rights modifier private to ensure that only the class to which the first global variable belongs can be called.
Illustratively, the present embodiment may utilize, but is not limited to, a For-loop approach to achieve a loop traversal of character elements in the target character array. When the For loop approach is utilized, the range of traversal should be: for (int index ═ 0; index < danmustarray. length-1; index + +). Assuming that the preset delimiter is "/", the determination may be made by calling danmutragraray [ index ] ═ '/', and if the expression is true, that is, the expression returns true, the split count1 performs a self-add operation. Where index is the index number of the current character element in the target character array danmuStrarray, and length is the length of the target character array danmuStrarray.
And S260, calling a character string segmentation function in the bullet screen data object by taking the second preset identifier as a function input parameter, segmenting the target bullet screen data by using the second preset identifier, and determining a character string array.
Specifically, in this embodiment, the second preset identifier is used as a function input parameter, a character string segmentation function is called, the target bullet screen data in the bullet screen data object is segmented by the second preset identifier, and the segmented character string data forms a character string array. Illustratively, if the target bullet screen data stored in the bullet screen data object danmuStr is: { type @/rid @ 104838/uid @ 20080138/wgei @ 0/}, and the second preset identifier "@", then by calling split srtarragay ═ danmuster. split ("\\\"), character string data obtained by splitting the target barrage data by "@" is stored into the character string array split srtarray, that is, split srtarray is: { "{ type", "uenter/rid" "104838/uid", "20080138/wgei", "═ 0/}".
S270, determining the number of second preset identifiers in the target bullet screen data according to the array length of the character string array.
Specifically, the present embodiment may obtain the array length of the string array splitstartarray by calling splitstartarray. For accurate and complete target bullet screen data, the first character in the target bullet screen data is a preset start character, and the last character in the target bullet screen data is a preset end character, so that one character string data exists before and after each second preset identifier in the target bullet screen data, the number of the character string data divided by the second preset identifier is 1 more than that of the second preset identifier, and therefore the number of the second preset identifier can be determined by subtracting 1 from the array length of the character string array.
And S280, if the number of the first preset identifiers is equal to that of the second preset identifiers, determining that the target bullet screen data is successfully verified.
Wherein, when the first preset character string structure includes the first preset identifier and the second preset identifier, through the analysis to the first preset character string structure, can derive: if the target bullet screen data is complete, the number of the first preset identifiers is equal to the number of the second preset identifiers, namely, the preset verification condition is as follows: the number of first preset identifiers is equal to the number of second preset identifiers.
Specifically, if the number of the first preset identifiers is equal to the number of the second preset identifiers, it is indicated that the preset verification condition is met, and at this time, it may be determined that the target bullet screen data is successfully verified. If the number of the first preset identifiers is not equal to the number of the second preset identifiers, it can be determined that the target bullet screen data check fails.
In the technical solution of this embodiment, after the target bullet screen data of the first preset character string structure is obtained, the first character verification function is invoked to detect whether the first character in the target bullet screen data is the preset start character, if yes, calling a second character verification function to detect whether the last character in the target bullet screen data is a preset terminator, if so, determining the number of first preset identifiers in the target bullet screen data by using an array conversion mode, determining the number of second preset identifiers in the target bullet screen data by using a character string segmentation mode, so that the number of the first preset identifier and the second preset identifier can be rapidly determined in various ways, and the check result of the target bullet screen data is determined by comparing whether the number of the first preset identifiers is equal to that of the second preset identifiers, so that bullet screen check is more convenient.
On the basis of the above technical solution, before calling the string conversion function in the bullet screen data object in S240, the method further includes: calling a character extraction function in the bullet screen data object, extracting character information between a first character and a last character in target bullet screen data, and determining the extracted character information as first bullet screen data; updating target bullet screen data stored in the bullet screen data object into first bullet screen data; correspondingly, calling a character string conversion function in the bullet screen data object in S240 to convert the target bullet screen data into a target character array, including: and calling a character string conversion function in the bullet screen data object, and converting the first bullet screen data into a target character array.
The character extraction function may be a predefined function for extracting character information between a first character and a last character in the target bullet screen data. Illustratively, by calling a character extraction function danmustr.sub (1, length-1) in a bullet screen data object danmuStr, where length is a character length in target bullet screen data, character information between a first character and a last character in the target bullet screen data can be acquired, and the extracted character information is determined as first bullet screen data. And updating target bullet screen data stored in the bullet screen data object into first bullet screen data so as to realize the conversion of the first bullet screen data by calling a character string conversion function in the bullet screen data object.
Specifically, in this embodiment, after the character verification is successful, it is indicated that the first character in the target bullet screen data is a preset start character, and the last character is a preset end character, which may not be a first preset identifier, so that only the character information between the first character and the last character in the target bullet screen data needs to be further verified, that is, the number of the first preset identifiers in the first bullet screen data is equal to the number of the first preset identifiers in the target bullet screen data. Assume that the target bullet screen data is: { type @/rid @ 104838/}, the character information extracted by calling danmustr. substring (1,26), i.e., the first barrage data is: type @/red 104838/@, so as to only predetermine the start symbol in the target barrage data and with predetermine the barrage data between the end symbol and verify, thereby can reduce the circulation and match the number of times, further improved the computational efficiency of first predetermined identifier quantity, and then promoted the check-up efficiency of barrage data.
EXAMPLE III
Fig. 3 is a flowchart of a method for checking bullet screen data according to a third embodiment of the present invention, and this embodiment describes in detail a "checking process of target bullet screen data with a preset character string structure being a second preset character string structure" based on the third embodiment. Wherein explanations of the same or corresponding terms as those of the above embodiments are omitted.
Referring to fig. 3, the method for verifying bullet screen data provided by this embodiment includes the following steps:
and S310, acquiring target bullet screen data of a second preset character string structure.
Wherein, the second preset character string structure includes: a preset start character, a first preset identifier, key-value pair information, a second preset identifier, at least one layer of nesting formed by a preset number of first preset character string structures, and a preset end character, wherein the value information does not contain the second preset identifier, the first preset identifier comprises one preset character, and the second preset identifier comprises two preset characters. A predetermined number of first predetermined string structures of the second predetermined string structure may form only one layer of nesting, i.e. the layer of nesting is formed by a predetermined number of first predetermined string structures; and multilayer nesting can be formed, namely all the layer nesting are formed by a first preset character string structure with a preset number, and the specific layer number can be determined according to a preset bullet screen protocol. The at least one nesting level formed by the predetermined number of first predetermined string structures may include a plurality of nesting ways.
Specifically, in this embodiment, each first preset character string structure may be regarded as one key value pair information, and the first preset character string structure and the other key value pair information are divided by the first preset identifier, and then nested in parallel into the second preset character string structure, so as to form a layer of nesting. For example, when the preset number is 2 and a layer of nesting is formed, the bullet screen data of the second preset character string structure may be:
{ type @ uenter/{ rid @ 104838/uid @ 20088/}/{ wgei @ 0/}/aveter @ www @ douyu/u/}, wherein the barrage data includes data of two first preset string structures, respectively { rid @ 104838/uid @ 20088/} and { wgei @ 0/}.
In this embodiment, each first preset character string structure may be nested with each other, and then the nested data is regarded as key value pair information and then nested into the second preset character string structure, thereby forming a multi-layer nesting. Illustratively, when the preset number is 2 and two-layer nesting is formed, the bullet screen data of the second preset character string structure is:
{ type @ uenter/{ rid @ 104838/{ uid @ 20088/wgei @ ═ 0/}/aveter @ www @ douyuu/}/}, wherein data { uid @ 20088/wgei @ 0/} of a first preset string structure is regarded as a key value pair information, nested into data { rid @ 104838/aveter @ www @ doeyuu/} of a second first preset string structure, so as to form a first layer nesting, and the first preset string structure is divided with other key value pair information by the first preset identifier, and then the nested structure { rid @ 104838/{ uid @ 88/wgei @/w @ 0 @/we/} is nested into a second preset string structure.
In this embodiment, the nesting manner may also be that a part of the first preset character string structures are nested in parallel, and another part of the first preset character string structures are nested with each other, and the specific nesting manner may be determined according to a preset bullet screen protocol. The nesting manner in the second preset character string structure is not specifically limited in this embodiment.
And S320, calling a character verification function in the bullet screen data object for storing the target bullet screen data, and performing character verification on the first character and the last character in the target bullet screen data.
S330, if the character verification is successful, calling a character string conversion function in the bullet screen data object, and converting the target bullet screen data into a target character array.
S340, matching each character element in the target character array with a first preset identifier, a preset start symbol and a preset end symbol respectively, and determining the number of the first preset identifiers, the number of the preset start symbols and the number of the preset end symbols in the target bullet screen data according to a matching result.
Specifically, the preset start symbols and the preset end symbols in the embodiment each include a preset character, so that the number of the preset start symbols and the number of the preset end symbols can also be determined by converting the array. According to the embodiment, the number of the first preset identifiers, the number of the preset start symbols and the number of the preset end symbols can be determined simultaneously in a mode of performing loop traversal on the target character array, so that the calculation efficiency is greatly improved.
Exemplarily, three global variables are first defined, where a first global variable split count1 is used to store the number of first preset identifiers in the target bullet screen data, that is, private int split count1 ═ 0; the second global variable splitCount2 is used for storing the number of preset start symbols in the target bullet screen data, that is, private int splitCount2 is 0; the third global variable splitCount3 is used to store the number of preset end symbols in the target bullet screen data, i.e. private int splitCount3 is 0. If the first preset identifier is "/", the preset start symbol is "{", and the preset end symbol is "}", in the same cycle period, whether the current character element in the target character array danmustaray is the first preset identifier may be determined by calling danmustaray [ index ] ═ i '/', and if the expression is true, that is, the expression returns true, the split count1 performs a self-adding operation, that is, the split count1 accumulates 1; otherwise, calling danmustarray [ index ] ═ {' to determine whether the current character element in the target character array danmustarray is a preset start symbol, and if the expression is true, namely the expression returns true, performing self-addition operation on the split count2, namely the split count2 accumulates 1; otherwise, calling danmustarray [ index ] ═ '}' to judge whether the current character element in the target character array danmustarray is a preset end character, if the expression is established, performing self-addition operation by the split count3, otherwise, updating the next character element of the current character element to be the current character element, namely index ═ index +1, and continuing to perform matching operation on the current character element until the current character element is the last character element in the target character array, namely index ═ danmustarray.
And S350, calling a character string segmentation function in the bullet screen data object by taking the second preset identifier as a function input parameter, segmenting the target bullet screen data by using the second preset identifier, and determining a character string array.
S360, determining the number of second preset identifiers in the target bullet screen data according to the array length of the character string array.
And S370, if the number of the preset start symbols is equal to the number of the preset end symbols, calculating a difference value between the number of the first preset identifiers and the number of the second preset identifiers.
Wherein, through analyzing the complete second preset character string structure, can see that: when the bullet screen data is complete, the number of the preset start symbols is equal to that of the preset end symbols, so that each first preset character string structure is guaranteed to correspond to one preset start symbol and one preset end symbol.
Specifically, if the number of the preset start symbols is equal to the number of the preset end symbols, the difference between the number of the first preset identifiers and the number of the second preset identifiers may be obtained by subtracting the number of the second preset identifiers from the number of the first preset identifiers, so as to perform the subsequent verification operation. If the number of the preset start symbols is not equal to the number of the preset end symbols, it is determined that the target bullet screen data is illegal data, and at this time, it can be directly determined that the target bullet screen data fails to be verified.
And S380, if the difference value is equal to the preset number, determining that the target bullet screen data is successfully verified.
Wherein, through analyzing the complete second preset character string structure, can see that: every time a first preset character string structure is nested in a second preset character string structure, a first preset identifier is added in the bullet screen data for division, and the number of second forecast identifiers is kept unchanged. If the second predetermined string structure includes a nested structure consisting of M first predetermined string structures, the number of the first predetermined identifiers is M more than the number of the second predictive identifiers for the complete bullet screen data.
Specifically, if the difference between the number of the first preset identifiers and the number of the second preset identifiers is equal to the preset number, it indicates that the target bullet screen data is complete, and at this time, it may be determined that the target bullet screen data is successfully verified, otherwise, it is determined that the target bullet screen data is failed to be verified. Optionally, in this embodiment, a difference between the number of the first preset identifiers and the number of the second preset identifiers may be calculated first, and it is checked whether the difference is equal to the preset number, if so, it is detected whether the number of the preset start symbols is equal to the number of the preset end symbols, and if so, it is determined that the target bullet screen data is successfully verified. In this embodiment, the execution sequence of S370 and S380 is not limited.
According to the technical scheme of the embodiment, when the second preset character string structure comprises at least one layer of nesting formed by a preset number of first preset character string structures, after the target bullet screen data of the second preset character string structure is successfully verified, the number of the first preset identifiers, the number of the preset start symbols and the number of the preset end symbols are simultaneously determined by using one target character array, so that the calculation efficiency can be greatly improved, and the verification result of the target bullet screen data is determined by detecting whether the number of the preset start symbols is equal to the number of the preset end symbols or not and whether the difference value between the number of the first preset identifiers and the number of the second preset identifiers is equal to the preset number or not, so that the integrity verification of the target bullet screen data of the second preset character string structure is performed, and the normal analysis of the bullet screen data is ensured.
Example four
Fig. 4 is a schematic structural diagram of a bullet screen data verification apparatus according to a fourth embodiment of the present invention, where this embodiment is applicable to a case of performing integrity verification on bullet screen data of a preset character string structure, and the apparatus may specifically include: the system comprises a target bullet screen data acquisition module 410, a character verification module 420, a first preset identifier number determination module 430, a second preset identifier number determination module 440 and a preset identifier number verification module 450.
The target barrage data acquiring module 410 is configured to acquire target barrage data of a preset character string structure, where the preset character string structure includes at least one preset identifier; the character verification module 420 is configured to call a character verification function in a bullet screen data object storing target bullet screen data, and perform character verification on a first character and a last character in the target bullet screen data; the first preset identifier number determining module 430 is configured to, if the character verification is successful, call a character string conversion function in the bullet screen data object when the preset identifier includes only one preset character, convert the target bullet screen data into a target character array, and determine the number of the preset identifiers in the target bullet screen data according to the target character array; the second preset identifier number determining module 440 is configured to, when the preset identifier includes at least two preset characters, invoke a character string segmentation function in the bullet screen data object, segment the target bullet screen data into character string arrays, and determine the number of the preset identifiers in the target bullet screen data according to the array length of the character string arrays; and a preset identifier number checking module 450, configured to determine that the target bullet screen data is successfully checked if the number of the preset identifiers meets a preset checking condition.
Optionally, the preset character string structure is a first preset character string structure, and the first preset character string structure is: the method comprises the steps of taking a preset start character as a first character, dividing each key value pair information by a first preset identifier, connecting the key information and the value information in the key value pair information by a second preset identifier, and taking a preset end character as a last character, wherein the value information does not contain the second preset identifier.
Optionally, the target barrage data obtaining module 410 is specifically configured to: acquiring bullet screen data to be verified and a bullet screen data identifier to be verified corresponding to the bullet screen data to be verified; matching the data identification to be verified with the data identification in the identification set corresponding to the preset character string structure; and if the matching is successful, determining the bullet screen data to be verified as target bullet screen data.
Optionally, the character verification module 420 includes a character verification function execution unit, configured to implement a function of performing character verification on the first character and the last character in the target bullet screen data by: calling a first character verification function, and detecting whether a first character in the target bullet screen data is a preset start character or not; if the first character is a preset start character, calling a second character verification function, and detecting whether the last character in the target bullet screen data is a preset end character; and if the last character is a preset terminator, determining that the character verification is successful.
Optionally, the first predetermined identifier comprises a predetermined character; correspondingly, the first preset identifier number determining module 430 is specifically configured to: and matching each character element in the target character array with a first preset identifier, and determining the number of the first preset identifiers in the target bullet screen data according to the matching result.
Optionally, the second preset identifier comprises two preset characters; correspondingly, the second preset identifier number determining module 440 is specifically configured to: calling a character string segmentation function in the bullet screen data object by taking the second preset identifier as a function input parameter, segmenting the target bullet screen data by using the second preset identifier, and determining a character string array; and determining the number of second preset identifiers in the target bullet screen data according to the array length of the character string array.
Optionally, the preset identifier number checking module 450 is specifically configured to: and if the number of the first preset identifiers is equal to that of the second preset identifiers, determining that the target bullet screen data is successfully verified.
Optionally, the preset character string structure is a second preset character string structure, and the second preset character string structure includes: a preset start character, a first preset identifier, key-value pair information, a second preset identifier, at least one layer of nesting formed by a preset number of first preset character string structures, and a preset end character, wherein the value information does not contain the second preset identifier, and the first preset identifier comprises a preset character;
correspondingly, the first preset identifier number determining module 430 is specifically configured to: matching each character element in the target character array with a first preset identifier, a preset start symbol and a preset end symbol respectively, and determining the number of the first preset identifiers, the number of the preset start symbols and the number of the preset end symbols in the target bullet screen data according to a matching result;
correspondingly, the preset identifier number checking module 450 is specifically configured to: if the number of the preset start symbols is equal to that of the preset end symbols, calculating the difference value between the number of the first preset identifiers and the number of the second preset identifiers; and if the difference value is equal to the preset number, determining that the target bullet screen data is successfully verified.
The bullet screen data verification device provided by the embodiment of the invention can execute the bullet screen data verification method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the bullet screen data verification method.
EXAMPLE five
Fig. 5 is a schematic structural diagram of a terminal according to a fifth embodiment of the present invention. Referring to fig. 5, the terminal includes:
one or more processors 510;
a memory 520 for storing one or more programs;
when the one or more programs are executed by the one or more processors 510, the one or more processors 510 implement the method for checking bullet screen data as set forth in any one of the above embodiments.
In FIG. 5, a processor 510 is illustrated as an example; the processor 510 and the memory 520 in the terminal may be connected by a bus or other means, as exemplified by the bus connection in fig. 5.
The memory 520 is a computer-readable storage medium, and can be used for storing software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to the bullet screen data verification method in the embodiment of the present invention (for example, the target bullet screen data acquisition module 410, the character verification module 420, the first preset identifier number determination module 430, the second preset identifier number determination module 440, and the preset identifier number verification module 450 in the bullet screen data verification device). The processor 510 executes various functional applications and data processing of the terminal by running software programs, instructions and modules stored in the memory 520, that is, implements the above-described bullet screen data verification method.
The memory 520 mainly includes a program storage area and a data storage area, wherein the program storage area can store an operating system and an application program required by at least one function; the storage data area may store data created according to the use of the terminal, and the like. Further, the memory 520 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, the memory 520 may further include memory located remotely from the processor 510, which may be connected to the terminal over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The terminal provided by the embodiment and the method for checking bullet screen data provided by the embodiment belong to the same inventive concept, and technical details which are not described in detail in the embodiment can be referred to the embodiment, and the embodiment has the same beneficial effects as the method for checking bullet screen data.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (10)

1. A bullet screen data verification method is characterized by comprising the following steps:
acquiring target bullet screen data of a preset character string structure, wherein the preset character string structure comprises at least one preset identifier;
calling a character verification function in a bullet screen data object for storing the target bullet screen data, and performing character verification on the first character and the last character in the target bullet screen data;
if the character verification is successful, calling a character string conversion function in the bullet screen data object when the preset identifier only comprises one preset character, converting the target bullet screen data into a target character array, and determining the number of the preset identifiers in the target bullet screen data according to the target character array; the number of the preset identifiers is obtained by comparing character elements with the preset identifiers;
when the preset identifier comprises at least two preset characters, calling a character string segmentation function in the bullet screen data object, segmenting the target bullet screen data into character string arrays, and determining the number of the preset identifiers in the target bullet screen data according to the array length of the character string arrays;
and if the number of the preset identifiers meets a preset verification condition, determining that the target bullet screen data is verified successfully.
2. The method of claim 1, wherein the predetermined string structure is a first predetermined string structure, and wherein the first predetermined string structure is: the method comprises the steps of taking a preset start character as a first character, dividing each key value pair information by a first preset identifier, connecting the key information and the value information in the key value pair information by a second preset identifier, and taking a preset end character as a last character, wherein the value information does not contain the second preset identifier.
3. The method according to claim 1, wherein the obtaining target bullet screen data of a preset character string structure comprises:
acquiring bullet screen data to be verified and a data identifier to be verified corresponding to the bullet screen data to be verified;
matching the data identification to be verified with the data identification in the identification set corresponding to the preset character string structure;
and if the matching is successful, determining the bullet screen data to be verified as the target bullet screen data.
4. The method according to claim 2, wherein the character verification function implements the function of character verifying the first and last characters in the target bullet screen data by:
calling a first character verification function, and detecting whether a first character in the target bullet screen data is a preset start character or not;
if the first character is the preset start character, calling a second character verification function, and detecting whether a last character in the target bullet screen data is a preset end character;
and if the last character is the preset terminator, determining that the character verification is successful.
5. The method of claim 2, wherein the first predetermined identifier comprises a predetermined character;
correspondingly, determining the number of preset identifiers in the target bullet screen data according to the target character array, including:
and matching each character element in the target character array with the first preset identifier, and determining the number of the first preset identifiers in the target bullet screen data according to a matching result.
6. The method of claim 2, wherein the second predetermined identifier comprises two predetermined characters;
correspondingly, calling a character string segmentation function in the bullet screen data object, segmenting the target bullet screen data into character string arrays, and determining the number of preset identifiers in the target bullet screen data according to the array length of the character string arrays, including:
calling a character string segmentation function in the bullet screen data object by taking the second preset identifier as a function input parameter, segmenting the target bullet screen data by using the second preset identifier, and determining a character string array;
and determining the number of second preset identifiers in the target bullet screen data according to the array length of the character string array.
7. The method of claim 2, wherein determining that the target bullet screen data is successfully verified if the number of the preset identifiers meets a preset verification condition comprises:
and if the number of the first preset identifiers is equal to that of the second preset identifiers, determining that the target bullet screen data is verified successfully.
8. The method of claim 2, wherein the predetermined string structure is a second predetermined string structure, and wherein the second predetermined string structure comprises: said predetermined start symbol, said first predetermined identifier, said key-value pair information, said second predetermined identifier, at least one layer of nesting formed by a predetermined number of said first predetermined string structures, said predetermined end symbol, wherein said value information does not include said second predetermined identifier, said first predetermined identifier comprising a predetermined character;
correspondingly, determining the number of preset identifiers in the target bullet screen data according to the target character array, including:
matching each character element in the target character array with the first preset identifier, the preset start symbol and the preset end symbol respectively, and determining the number of the first preset identifiers, the number of the preset start symbols and the number of the preset end symbols in the target bullet screen data according to a matching result;
correspondingly, if the number of the preset identifiers meets a preset verification condition, it is determined that the target bullet screen data is successfully verified, and the method includes:
if the number of the preset start symbols is equal to the number of the preset end symbols, calculating a difference value between the number of the first preset identifiers and the number of the second preset identifiers;
and if the difference is equal to the preset number, determining that the target bullet screen data is successfully verified.
9. The utility model provides a check-up device of barrage data which characterized in that includes:
the system comprises a target barrage data acquisition module, a target barrage data acquisition module and a target barrage data acquisition module, wherein the target barrage data acquisition module is used for acquiring target barrage data of a preset character string structure, and the preset character string structure comprises at least one preset identifier;
the character verification module is used for calling a character verification function in a bullet screen data object for storing the target bullet screen data and performing character verification on the first character and the last character in the target bullet screen data;
the first preset identifier quantity determining module is used for calling a character string conversion function in the bullet screen data object when the preset identifier only comprises one preset character if the character verification is successful, converting the target bullet screen data into a target character array, and determining the quantity of the preset identifiers in the target bullet screen data according to the target character array; the number of the preset identifiers is obtained by comparing character elements with the preset identifiers;
the second preset identifier quantity determining module is used for calling a character string segmentation function in the bullet screen data object when the preset identifier comprises at least two preset characters, segmenting the target bullet screen data into character string arrays, and determining the quantity of the preset identifiers in the target bullet screen data according to the array length of the character string arrays;
and the preset identifier number checking module is used for determining that the target bullet screen data is successfully checked if the number of the preset identifiers meets a preset checking condition.
10. A terminal, characterized in that the terminal comprises:
one or more processors;
a memory for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement a method of verifying bullet screen data as claimed in any one of claims 1 to 8.
CN201811160420.0A 2018-09-30 2018-09-30 Bullet screen data verification method and device and terminal Active CN109413451B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811160420.0A CN109413451B (en) 2018-09-30 2018-09-30 Bullet screen data verification method and device and terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811160420.0A CN109413451B (en) 2018-09-30 2018-09-30 Bullet screen data verification method and device and terminal

Publications (2)

Publication Number Publication Date
CN109413451A CN109413451A (en) 2019-03-01
CN109413451B true CN109413451B (en) 2021-07-23

Family

ID=65465998

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811160420.0A Active CN109413451B (en) 2018-09-30 2018-09-30 Bullet screen data verification method and device and terminal

Country Status (1)

Country Link
CN (1) CN109413451B (en)

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9275036B2 (en) * 2006-12-21 2016-03-01 International Business Machines Corporation System and method for adaptive spell checking
CN106792208A (en) * 2016-11-24 2017-05-31 武汉斗鱼网络科技有限公司 Video preference information processing method, apparatus and system
CN106973332A (en) * 2017-03-10 2017-07-21 武汉斗鱼网络科技有限公司 A kind of barrage message treatment method, analytic method and system
CN107465738A (en) * 2017-08-01 2017-12-12 深圳市金立通信设备有限公司 A kind of communication means, server and computer-readable recording medium
CN107707986B (en) * 2017-10-09 2019-12-03 武汉斗鱼网络科技有限公司 A kind of method and device for simulating barrage message in the exploitation of live streaming software

Also Published As

Publication number Publication date
CN109413451A (en) 2019-03-01

Similar Documents

Publication Publication Date Title
CN109345388B (en) Block chain intelligent contract verification method and device and storage medium
CN108694320B (en) Method and system for measuring sensitive application dynamic under multiple security environments
CN111339531B (en) Malicious code detection method and device, storage medium and electronic equipment
CN109299719B (en) Bullet screen checking method and device based on character segmentation, terminal and storage medium
CN109413016B (en) Rule-based message detection method and device
CN108256322B (en) Security testing method and device, computer equipment and storage medium
EP3934163A1 (en) Methods and consensus nodes for block generation
CN113946546B (en) Abnormality detection method, computer storage medium, and program product
KR102242219B1 (en) Method and device for preventing the server from being attacked
CN112181430B (en) Code change statistical method, device, electronic equipment and storage medium
CN112732563A (en) Interface script test log extraction method and device, terminal and storage medium
CN109413450B (en) Bullet screen data integrity verification method and device, terminal and storage medium
CN109348304B (en) Bullet screen data verification method and device and terminal
CN109413451B (en) Bullet screen data verification method and device and terminal
CN109379640B (en) Bullet screen checking method and device based on linked list mode, terminal and storage medium
CN109348305B (en) Bullet screen data verification method and device, terminal and storage medium
CN109413506B (en) Bullet screen data verification method and device, terminal and storage medium
CN109325496B (en) Bullet screen checking method and device based on character removal, terminal and storage medium
CN116361793A (en) Code detection method, device, electronic equipment and storage medium
CN111556042B (en) Malicious URL detection method and device, computer equipment and storage medium
CN109413505B (en) Bullet screen data verification method and device, terminal and storage medium
CN109413504B (en) Bullet screen checking method, device, terminal and storage medium based on character string replacement
CN109413452B (en) Bullet screen checking method and device based on different modes, terminal and storage medium
CN112711574A (en) Database security detection method and device, electronic equipment and medium
CN111694588A (en) Engine upgrade detection method and device, computer equipment and readable storage medium

Legal Events

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