Video data acquisition method, device, electronic device and storage medium
By obtaining hot news keywords and creating crawling threads to obtain and process video data, it solves the problem of poor short video dissemination effect and improves user experience and news dissemination effect.
Patent Information
- Application Number
- CN202111068595.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-13
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2041-09-13
AI Technical Summary
The effect of disseminating news in the form of short videos in the existing technology is poor, which affects the user's experience of browsing news content in the form of short videos.
By obtaining the keywords of multiple hot news, create a crawling thread corresponding to the keyword, obtain the text information of the hot video corresponding to each keyword, obtain the video data based on the text information, and use the daemon thread to handle the interruption of the crawling thread. , perform deduplication operations and store video data to improve the effect of news dissemination.
It improves the effect of disseminating hot news in the form of video, improves user experience, provides a large amount of hot news video data, and enhances users' video browsing experience.
Smart Images

Figure CN113849686B
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of Internet technology, and in particular to a method, device, electronic device and storage medium for acquiring video data. Background Art
[0002] At present, major portals can provide users with different types of news, and with the rapid development of the content recommendation field, more and more news will be disseminated in the form of short videos.
[0003] However, most of the news currently provided by major portals is presented in the form of pictures and texts (i.e., a combination of pictures and texts). In other words, major portals can provide relatively few short videos. Therefore, the effect of disseminating news in the form of short videos in certain applications (such as short video APPs) is relatively poor, which affects users' expectation of browsing news content in the form of short videos. Summary of the invention
[0004] The present disclosure provides a video data acquisition method, device, electronic device and storage medium, which solve the technical problem in the prior art that the effect of disseminating news in the form of short videos is poor, affecting the user's experience of browsing news content in the form of short videos.
[0005] The technical solution of the embodiment of the present disclosure is as follows:
[0006] According to a first aspect of an embodiment of the present disclosure, a method for acquiring video data is provided. The method may include: acquiring keywords of multiple hot news; creating a crawling thread corresponding to the acquired keywords, and acquiring text information of a hot video corresponding to each keyword based on the created crawling thread, wherein the text information is used to characterize the corresponding hot video; and acquiring video data of the hot video based on the acquired text information.
[0007] Optionally, the above-mentioned creation of a crawling thread corresponding to the acquired keywords specifically includes: dividing the keywords of the multiple hot news to obtain N keyword sets, wherein each keyword set includes at least one keyword, N≥1; creating a crawling thread for each keyword set to obtain N crawling threads; the above-mentioned acquisition of the text information of the hot video corresponding to each keyword based on the created crawling thread specifically includes: based on each crawling thread in the N crawling threads, acquiring the text information of the hot video corresponding to each keyword in the corresponding keyword set.
[0008] Optionally, the acquiring of the video data of the hot video based on the acquired text information specifically includes: obtaining the video data of the hot video based on the N capture threads and the acquired text information.
[0009] Optionally, the target crawling thread is configured with a daemon thread, and the target crawling thread is any one of the N crawling threads. The above-mentioned acquisition of the text information of the hot videos corresponding to each keyword in the corresponding keyword set based on each crawling thread in the N crawling threads specifically includes: calling the target crawling thread to acquire the text information of the hot videos corresponding to each keyword in the target keyword set, and the target keyword set corresponds to the target crawling thread; after determining that the text information of the hot videos corresponding to the first keyword has been successfully acquired, adding an identifier to the first keyword, and the identifier is used to indicate that the text information of the corresponding hot videos has been successfully acquired, and the first keyword is a keyword included in the target keyword set; in the case that the text information of the hot videos corresponding to all the keywords in the target keyword set has not been acquired and the target crawling thread is interrupted, calling the daemon thread to restart the target crawling thread, and acquiring the text information of the hot videos corresponding to the keywords that do not carry the identifier based on the target crawling thread.
[0010] Optionally, the above-mentioned obtaining the video data of the hot video based on the acquired text information specifically includes: based on the acquired text information, performing a deduplication operation on the text information to obtain the text information after the deduplication operation; based on the text information after the deduplication operation, obtaining the video data of each hot video.
[0011] Optionally, the above-mentioned deduplication operation on the text information specifically includes: when the difference between the duration of the first hot video and the duration of the second hot video is less than a duration difference threshold, or when the similarity between the cover data of the first hot video and the cover data of the second hot video is greater than a similarity threshold, deleting the text information of the first hot video or the text information of the second hot video, the first hot video is one of the multiple hot videos corresponding to each keyword, and the second hot video is one of the multiple hot videos except the first hot video.
[0012] Optionally, the above-mentioned video data acquisition method also includes: storing the text information of the hot video corresponding to each keyword into a database.
[0013] According to a second aspect of an embodiment of the present disclosure, a video data acquisition device is provided. The device may include an acquisition module and a processing module; the acquisition module is configured to acquire keywords of multiple hot news; the processing module is configured to create a crawling thread corresponding to the acquired keywords; the acquisition module is further configured to acquire text information of a hot video corresponding to each keyword based on the created crawling thread, the text information is used to characterize the corresponding hot video; the acquisition module is further configured to acquire video data of the hot video based on the acquired text information.
[0014] Optionally, the processing module is specifically configured to divide the keywords of the multiple hot news to obtain N keyword sets, wherein each keyword set includes at least one keyword, and N≥1; the processing module is also specifically configured to create a crawling thread for each keyword set to obtain N crawling threads; the acquisition module is specifically configured to acquire the text information of the hot video corresponding to each keyword in the corresponding keyword set based on each crawling thread in the N crawling threads.
[0015] Optionally, the acquisition module is further configured to obtain the video data of the hot video based on the N capture threads and the acquired text information.
[0016] Optionally, the target crawling thread is configured with a daemon thread, and the target crawling thread is any one of the N crawling threads; the acquisition module is specifically configured to call the target crawling thread to obtain the text information of the hot videos corresponding to each keyword in the target keyword set, and the target keyword set corresponds to the target crawling thread; the processing module is specifically configured to add an identifier to the first keyword after determining that the text information of the hot video corresponding to the first keyword has been successfully obtained, and the identifier is used to indicate that the text information of the corresponding hot video has been successfully obtained, and the first keyword is a keyword included in the target keyword set; the processing module is specifically configured to call the daemon thread to restart the target crawling thread when the text information of the hot videos corresponding to all the keywords in the target keyword set has not been obtained and the target crawling thread is interrupted; the acquisition module is specifically configured to obtain the text information of the hot videos corresponding to the keywords that do not carry the identifier based on the target crawling thread.
[0017] Optionally, the processing module is further configured to perform a deduplication operation on the text information based on the acquired text information to obtain the text information after the deduplication operation; the acquisition module is further configured to obtain the video data of each hot video based on the text information after the deduplication operation.
[0018] Optionally, the above-mentioned video data acquisition device also includes a deletion module; the deletion module is configured to delete the text information of the first hot video or the text information of the second hot video when the difference between the duration of the first hot video and the duration of the second hot video is less than a duration difference threshold, or when the similarity between the cover data of the first hot video and the cover data of the second hot video is greater than a similarity threshold, the first hot video is one of the multiple hot videos corresponding to each keyword, and the second hot video is one of the multiple hot videos except the first hot video.
[0019] Optionally, the processing module is further configured to store the text information of the hot video corresponding to each keyword into a database.
[0020] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, which may include: a processor and a memory configured to store processor executable instructions; wherein the processor is configured to execute the instructions to implement any one of the optional video data acquisition methods in the above-mentioned first aspect.
[0021] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, on which instructions are stored. When the instructions in the computer-readable storage medium are executed by an electronic device, the electronic device is enabled to execute any one of the optional video data acquisition methods in the first aspect described above.
[0022] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided, which includes computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes any optional video data acquisition method as described in the first aspect.
[0023] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:
[0024] Based on any of the above aspects, in the present disclosure, the electronic device can obtain keywords of multiple hot news, and then create a crawling thread corresponding to the obtained keywords, and obtain the text information of the hot video corresponding to each keyword based on the created crawling thread; the electronic device obtains the video data of the hot video based on the obtained text information. In the embodiment of the present disclosure, the electronic device can obtain the text information of a large amount of hot videos based on the created crawling thread, and then obtain the video data of a large amount of hot videos. It can provide a large number of news hot videos, improve the effect of spreading hot news in the form of video, and enhance the user experience.
[0025] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0027] Figure 1 A schematic diagram of a process of obtaining video data provided by an embodiment of the present disclosure is shown;
[0028] Figure 2A schematic diagram showing a flow chart of another video data acquisition method provided by an embodiment of the present disclosure;
[0029] Figure 3 A schematic diagram showing a flow chart of another method for acquiring video data provided by an embodiment of the present disclosure;
[0030] Figure 4 A schematic diagram showing a flow chart of another video data acquisition method provided by an embodiment of the present disclosure;
[0031] Figure 5 A schematic diagram showing a flow chart of another method for acquiring video data provided by an embodiment of the present disclosure;
[0032] Figure 6 A schematic diagram showing a flow chart of another method for acquiring video data provided by an embodiment of the present disclosure;
[0033] Figure 7 A schematic diagram showing a flow chart of another video data acquisition method provided by an embodiment of the present disclosure;
[0034] Figure 8 A schematic diagram of the structure of a video data acquisition device provided by an embodiment of the present disclosure is shown;
[0035] Fig. 9 A schematic structural diagram of another video data acquisition device provided in an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0036] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0037] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0038] It should also be understood that the term “comprising” indicates the presence of described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements and / or components.
[0039] The data involved in the present disclosure may be data authorized by the user or fully authorized by all parties.
[0040] Some concepts involved in the embodiments of the present disclosure are explained below.
[0041] Thread: It is the smallest unit that the operating system can perform computation scheduling. It is included in the process and is the actual operation unit in the process. In the disclosed embodiment, the electronic device can obtain the text information of the hot video corresponding to each keyword based on the preset crawling thread.
[0042] As described in the background technology, in the prior art, the effect of spreading news in the form of short videos is poor, which affects the user's experience of browsing news content in the form of short videos. Based on this, the embodiment of the present disclosure provides a video data acquisition method, and an electronic device can acquire a large amount of video data of hot videos, which can improve the effect of spreading hot news in the form of videos and enhance the user experience.
[0043] The video data acquisition method, device, electronic device and storage medium provided by the embodiments of the present disclosure are applied to news browsing or news recommendation scenarios. When multiple keywords of hot news are obtained, the video data of the hot videos can be obtained according to the method provided by the embodiments of the present disclosure.
[0044] The following is an exemplary description of the video data acquisition method provided by the embodiment of the present disclosure in conjunction with the accompanying drawings:
[0045] It is understandable that the electronic device that executes the video data acquisition method provided by the embodiment of the present disclosure may be a mobile phone, tablet computer, desktop, laptop, handheld computer, notebook computer, ultra-mobile personal computer (UMPC), netbook, as well as cellular phone, personal digital assistant (PDA), augmented reality (AR)\virtual reality (VR) equipment and other equipment that can install and use content community applications, and the present disclosure does not impose any special restrictions on the specific form of the electronic device. It can interact with the user through one or more methods such as keyboard, touchpad, touch screen, remote control, voice interaction or handwriting device.
[0046] like Figure 1 As shown, the video data acquisition method provided by the embodiment of the present disclosure may include S101-S103.
[0047] S101. The electronic device obtains keywords of a plurality of hot news.
[0048] It should be understood that the electronic device can obtain multiple hot news (from multiple countries or regions) from major websites around the world (specifically, news hot lists of major websites, such as Google Trends, Facebook hot list, and Twitter hot list, etc.), and then obtain at least one keyword corresponding to the multiple hot news. The keywords of the multiple hot news can be keywords obtained after deduplication.
[0049] Optionally, the electronic device may store the keywords of the multiple hot news in a database.
[0050] S102: The electronic device creates a capture thread corresponding to the acquired keyword, and acquires text information of a hot video corresponding to each keyword based on the created capture thread.
[0051] The text information is used to represent the corresponding hot video.
[0052] It should be understood that the acquired keyword may correspond to one crawling thread or multiple crawling threads.
[0053] It is understandable that a keyword may correspond to at least one hot video, and a hot video may correspond to a text message. In the disclosed embodiment, the electronic device may crawl each acquired keyword based on the created crawling thread to obtain the text information of the hot video corresponding to each keyword.
[0054] In one implementation of the embodiment of the present disclosure, the text information of a hot video may include a video link of the hot video, that is, the electronic device may access (or query) the video data of the hot video based on the video link.
[0055] Optionally, the electronic device can obtain text information of the hot video corresponding to each keyword from websites such as youtube, twitter and Facebook.
[0056] S103: The electronic device obtains video data of the hot video based on the obtained text information.
[0057] In one case, the text information obtained by the electronic device is all the text information in the text information of the hot videos corresponding to each of the above keywords (or the text information of all the hot videos). At this time, the video data of the hot videos obtained by the electronic device is the video data of all the hot videos corresponding to each keyword.
[0058] In another case, the text information obtained by the electronic device is part of the text information of the hot video corresponding to each of the above keywords (or part of the text information of the hot video). At this time, the video data of the hot video obtained by the electronic device is the video data of this part of the hot video.
[0059] In combination with the description of the above embodiments, it should be understood that an electronic device can obtain (or download) the video data of a hot video after accessing the video data of the hot video based on a video connection of the hot video. The download is to download the video data of the hot video from the source electronic device corresponding to the source electronic device to the electronic device.
[0060] The technical solution provided by the above embodiment can at least bring the following beneficial effects: As can be seen from S101-S103, the electronic device can obtain keywords of multiple hot news, and then create a crawling thread corresponding to the obtained keywords, and obtain the text information of the hot video corresponding to each keyword based on the created crawling thread; the electronic device obtains the video data of the hot video based on the obtained text information. In the disclosed embodiment, the electronic device can obtain the text information of a large amount of hot videos based on the created crawling thread, and then obtain the video data of a large amount of hot videos. It can provide a large number of news hot videos, improve the effect of spreading hot news in the form of video, and enhance the user experience.
[0061] Combination Figure 1 ,like Figure 2 As shown, in one implementation of the embodiment of the present disclosure, the electronic device creating a crawling thread corresponding to the acquired keyword may specifically include S1021-S1023.
[0062] S1021. The electronic device divides keywords of a plurality of hot news items to obtain N keyword sets.
[0063] Each keyword set includes at least one keyword, N≥1
[0064] Optionally, the electronic device may divide the keywords of multiple hot news (hereinafter referred to as multiple keywords) according to the order in which they are obtained (i.e., the existing order in which the multiple keywords are obtained). For example, the first 10 keywords may be divided into the first keyword set, and the 11th to 20th keywords may be divided into the second keyword set, etc.
[0065] S1022: The electronic device creates a crawling thread for each keyword set to obtain N crawling threads.
[0066] It should be understood that one capture thread corresponds to one keyword set. The electronic device can capture (or obtain) text information of a hot video corresponding to one keyword at one time based on one capture thread.
[0067] Continue as Figure 2 As shown, in one implementation of the embodiment of the present disclosure, the above-mentioned acquisition of text information of the hot video corresponding to each keyword based on the created crawling thread may specifically include S1023.
[0068] S1023: The electronic device obtains text information of a hot video corresponding to each keyword in the corresponding keyword set based on each of the N grabbing threads.
[0069] In combination with the description of the above embodiments, it should be understood that a crawling thread corresponds to a keyword set, and a keyword set includes at least one keyword. For a crawling thread, the electronic device can obtain the text information of the hot video corresponding to any keyword in the keyword set corresponding to the crawling thread, and then obtain the text information of the hot video corresponding to each keyword included in the keyword set.
[0070] It can be understood that the electronic device can start each of the N crawling threads at the same time, that is, each crawling thread runs simultaneously, to obtain the text information of the hot videos corresponding to the keywords included in each keyword set in the N keyword sets, that is, more keywords can be crawled at the same time (or at one time), and the text information of the hot videos corresponding to the more keywords can be obtained at the same time.
[0071] The technical solution provided by the above embodiment can at least bring the following beneficial effects: From S1021-S1023, it can be known that the electronic device can divide the keywords of multiple hot news to obtain N keyword sets, and create a crawling thread for each keyword set to obtain N crawling threads, and based on each crawling thread in the N crawling threads, obtain the text information of the hot video corresponding to each keyword in the corresponding keyword set. In the disclosed embodiment, the electronic device can start each of the N crawling threads at the same time, can crawl more keywords at the same time (or at one time), and can simultaneously obtain the text information of the hot videos corresponding to the more keywords. It is possible to obtain more text information more quickly, and then quickly obtain the video data of the hot video.
[0072] Combination Figure 1 ,like Figure 3 As shown, in one implementation of the embodiment of the present disclosure, the electronic device obtains video data of the hot video based on the acquired text information, which may specifically include S1031.
[0073] S1031. The electronic device obtains video data of the hot video based on the N captured threads and the acquired text information.
[0074] In combination with the description of the above embodiment, it should be understood that the electronic device can obtain the text information of the hot video corresponding to the keyword included in each keyword set in the N keyword sets based on each of the N crawling threads. That is, for one crawling thread, the electronic device can obtain the text information of the hot video corresponding to any keyword in the keyword set corresponding to the crawling thread based on the keyword.
[0075] In the disclosed embodiment, the electronic device can also obtain the video data of the hot video corresponding to the acquired text information based on each of the N grabbing threads. Specifically, for one grabbing thread, the electronic device can obtain the video data of the hot video corresponding to the text information based on the text information of the hot video corresponding to any keyword in the keyword set corresponding to the grabbing thread. It can be understood that the electronic device starts each of the N grabbing threads at the same time, and each of the grabbing threads runs at the same time to obtain more video data of hot videos at the same time.
[0076] The technical solution provided by the above embodiment can at least bring the following beneficial effects: As can be seen from S1031, the electronic device can obtain the video data of the hot video based on the N capture threads and the acquired text information. In the disclosed embodiment, the electronic device can simultaneously start each of the N capture threads, can capture more text information at the same time (or at one time), and can simultaneously acquire the video data of the hot video corresponding to the more text information. It can improve the efficiency of obtaining video data.
[0077] Combination Figure 2 ,like Figure 4 As shown, in one implementation of the embodiment of the present disclosure, the electronic device obtains text information of the hot video corresponding to each keyword in the corresponding keyword set based on each of the N crawling threads, which may specifically include S1023a-S1023c.
[0078] S1023a. The electronic device calls a target crawling thread to obtain text information of a hot video corresponding to each keyword in the target keyword set.
[0079] The target keyword set corresponds to the target crawling thread, and the target crawling thread is any one of the above-mentioned N crawling threads.
[0080] It should be understood that the electronic device can call any one of the N crawling threads to obtain the text information of the hot video corresponding to each keyword in the keyword set corresponding to the crawling thread.
[0081] S1023b: After determining that the text information of the hot video corresponding to the first keyword has been successfully acquired, the electronic device adds a label to the first keyword.
[0082] The identifier is used to indicate that the text information of the corresponding hot video has been successfully obtained, and the first keyword is a keyword included in the target keyword set.
[0083] It should be understood that after the electronic device adds a tag to the first keyword, the first keyword carries the tag. Correspondingly, if a keyword is not marked, that is, the keyword does not carry the tag, it means that the electronic device has not successfully obtained the text information of the hot video corresponding to the keyword.
[0084] S1023c. When the text information of the hot videos corresponding to all the keywords in the target keyword set is not obtained and the target crawling thread is interrupted, the electronic device calls the daemon thread to restart the target crawling thread, and obtains the text information of the hot videos corresponding to the keywords without identification based on the target crawling thread.
[0085] The target capture thread is configured with the daemon thread.
[0086] It is understandable that the electronic device may configure a daemon thread for the target capture thread, and the daemon thread is used to restart the target capture thread.
[0087] For example, suppose the target keyword set includes 10 keywords, 8 of which are marked by the electronic device, and 2 keywords do not carry marks (that is, the electronic device does not obtain the text information of the hot videos corresponding to all the keywords in the target keyword set). If the target crawling thread is interrupted at this time, the electronic device can call the daemon thread, restart the target crawling thread, and obtain the text information of the hot videos corresponding to the 2 keywords based on the target crawling thread.
[0088] The technical solution provided by the above embodiment can at least bring the following beneficial effects: From S1023a-S1023C, it can be known that the electronic device can call the target capture thread to obtain the text information of the hot videos corresponding to each keyword in the target keyword set; after determining that the text information of the hot videos corresponding to the first keyword has been successfully obtained, the electronic device can add an identifier for the first keyword (the first keyword carries the identifier at this time); in the case where the text information of the hot videos corresponding to all the keywords in the target keyword set is not obtained and the target capture thread is interrupted, the electronic device can call the daemon thread to restart the target capture thread, and obtain the text information of the hot videos corresponding to the keywords that do not carry the identifier based on the target capture thread. In the disclosed embodiment, when the target capture thread is interrupted, the electronic device can call the daemon thread to restart the target capture thread, and continue to capture keywords whose text information has not been obtained before, and then obtain the text information of the hot videos corresponding to all the keywords included in the target keyword set. It can accurately and completely capture each keyword, and then obtain the text information of the hot videos corresponding to each keyword, thereby improving the effectiveness of text information acquisition.
[0089] Combination Figure 1 ,like Figure 5 As shown, in one implementation of the embodiment of the present disclosure, the electronic device obtains video data of the hot video based on the obtained text information, which may specifically include S1032-S1033.
[0090] S1032: The electronic device performs a deduplication operation on the text information based on the acquired text information to obtain text information after the deduplication operation.
[0091] It should be understood that the hot videos corresponding to each keyword (i.e., the above-mentioned multiple keywords) may contain the same (or repeated) hot videos. In this way, the text information obtained by the electronic device based on the created crawling thread may also contain the same (or repeated) text information. In the embodiment of the present disclosure, the electronic device can perform a deduplication operation on the obtained text information, that is, remove one of the two identical (or repeated) text information. The text information obtained after the deduplication operation does not include the same (or repeated) text information.
[0092] S1033. The electronic device obtains video data of each hot video based on the text information after the deduplication operation.
[0093] It is understandable that each hot video is a hot video corresponding to each text information obtained after the deduplication operation. In one implementation, the electronic device can access the video connection of each hot video obtained after the deduplication operation to obtain the video data of each hot video.
[0094] The technical solution provided by the above embodiment can at least bring the following beneficial effects: As can be seen from S1032-S1033, the electronic device can perform a deduplication operation on the text information based on the acquired text information to obtain the text information after the deduplication operation, and obtain the video data of each hot video based on the text information obtained after the deduplication operation. The same or repeated text information included in the acquired text information can be screened to reduce the energy consumption of the electronic device while ensuring the quality of the video data.
[0095] Combination Figure 5 ,like Figure 6 As shown, in one implementation of the embodiment of the present disclosure, the above-mentioned deduplication operation on the text information may specifically include S1032a.
[0096] S1032a. When the difference between the duration of the first hot video and the duration of the second hot video is less than the duration difference threshold, or when the similarity between the cover data of the first hot video and the cover data of the second hot video is greater than the similarity threshold, the electronic device deletes the text information of the first hot video or the text information of the second hot video.
[0097] Among them, the first hot video is one of the multiple hot videos corresponding to each of the above keywords, and the second hot video is one of the multiple hot videos except the first hot video.
[0098] It is understandable that the video data of a hot video may include the duration of the hot video.
[0099] In combination with the description of the above embodiments, it should be understood that for the first hot video (or the second hot video), the text information of the first hot video may include a video link of the first hot video, and the electronic device can access and obtain the video data of the first hot video based on the video link of the first hot video, and then obtain the duration of the first hot video.
[0100] In one implementation of the disclosed embodiment, the text information of a hot video may also include a cover link of the hot video. Specifically, for the first hot video (or the second hot video), the electronic device may access and obtain the cover data of the first hot video (which may be understood as the cover image of the first hot video) based on the cover link of the first hot video, and then determine the similarity between the cover data of the first hot video and the cover data of the second hot video.
[0101] Optionally, the electronic device can input the cover data of the first hot video and the cover data of the second hot video into the ResNet network to obtain the cover vector of the first hot video and the cover vector of the second hot video, and determine the COS similarity between the two cover vectors, and determine the COS similarity as the similarity between the cover data of the first hot video and the cover data of the second hot video.
[0102] It should be understood that if the difference between the duration of the first hot video and the duration of the second hot video is less than the duration difference, it means that the duration of the first hot video and the duration of the second hot video are slightly different, which can also be understood as similar duration; if the similarity between the cover data of the first hot video and the cover data of the second hot video is greater than the similarity threshold, it means that the similarity between the cover data (or cover picture) of the first hot video and the cover data (or cover picture) of the second hot video is high, or relatively similar.
[0103] In the disclosed embodiment, when the duration of the first hot video is slightly different from that of the second hot video, or the cover data (or cover image) of the first hot video is relatively similar to that of the second hot video, the electronic device can determine that the first hot video and the second hot video are identical or duplicate hot videos, and the text information corresponding to the first hot video and the text information corresponding to the second hot video are identical or duplicate text information, so the electronic device can delete the text information of the first hot video or the text information of the second hot video. That is, for two identical or duplicate text information, only one of the text information is retained.
[0104] The technical solution provided by the above embodiment can at least bring the following beneficial effects: It can be known from S1032a that when the difference between the duration of the first hot video and the duration of the second hot video is less than the duration difference threshold, or when the similarity between the cover data of the first hot video and the cover data of the second hot video is greater than the similarity threshold, the electronic device can delete the text information of the first hot video or the text information of the second hot video. In the embodiment of the present disclosure, for two identical or repeated text information, the electronic device can only retain one of the text information. It can ensure that the final text information does not contain identical or repeated text information, thereby improving the quality of video data acquisition.
[0105] Combination Figure 1 ,like Figure 7 As shown, in one implementation, the video data acquisition method provided by the embodiment of the present disclosure may further include S104.
[0106] S104: The electronic device stores the text information of the hot video corresponding to each keyword in a database.
[0107] It should be understood that the electronic device stores the text information of the hot video corresponding to each keyword in a database, so that the electronic device can obtain all (or part) of the text information of the hot video from the database.
[0108] Optionally, the database may be a MongoDB database or a MySQL database.
[0109] The technical solution provided by the above embodiment can at least bring the following beneficial effects: as can be seen from S104, the electronic device can store the text information of the hot video corresponding to each keyword in a database, so that the electronic device can obtain all (or part) of the text information of the hot video from the database, which can improve the efficiency of obtaining text information, and then improve the efficiency of obtaining video data.
[0110] It is understandable that, in actual implementation, the electronic device described in the embodiment of the present disclosure may include one or more hardware structures and / or software modules for implementing the aforementioned corresponding video data acquisition method, and these execution hardware structures and / or software modules may constitute an electronic device. Those skilled in the art should easily realize that, in combination with the algorithm steps of each example described in the embodiment disclosed herein, the present disclosure can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present disclosure.
[0111] Based on this understanding, the embodiment of the present disclosure also provides a video data acquisition device. Figure 8 FIG. 2 shows a schematic diagram of the structure of a video data acquisition device provided by an embodiment of the present disclosure. Figure 8 As shown, the video data acquisition device 10 may include: an acquisition module 101 and a processing module 102 .
[0112] The acquisition module 101 is configured to acquire keywords of a plurality of hot news; the processing module is configured to create a crawling thread corresponding to the acquired keywords.
[0113] The acquisition module 101 is further configured to acquire text information of the hot video corresponding to each keyword based on the created crawling thread, and the text information is used to characterize the corresponding hot video.
[0114] The acquisition module 101 is further configured to acquire video data of the hot video based on the acquired text information.
[0115] Optionally, the processing module 102 is specifically configured to divide the keywords of the multiple hot news to obtain N keyword sets, wherein each keyword set includes at least one keyword, and N≥1.
[0116] The processing module 102 is further configured to create a crawling thread for each keyword set, thereby obtaining N crawling threads.
[0117] The acquisition module 101 is specifically configured to acquire text information of a hot video corresponding to each keyword in the corresponding keyword set based on each of the N capture threads.
[0118] Optionally, the acquisition module 101 is further configured to obtain the video data of the hot video based on the N capture threads and the acquired text information.
[0119] Optionally, a target grabbing thread is configured with a daemon thread, and the target grabbing thread is any one of the N grabbing threads.
[0120] The acquisition module 101 is further specifically configured to call the target crawling thread to acquire text information of hot videos corresponding to each keyword in the target keyword set, and the target keyword set corresponds to the target crawling thread.
[0121] The processing module 102 is also specifically configured to add an identifier to the first keyword after determining that the text information of the hot video corresponding to the first keyword has been successfully obtained. The identifier is used to indicate that the text information of the corresponding hot video has been successfully obtained. The first keyword is a keyword included in the target keyword set.
[0122] The processing module 102 is further specifically configured to call the daemon thread to restart the target crawling thread when the text information of the hot videos corresponding to all the keywords in the target keyword set is not obtained and the target crawling thread is interrupted.
[0123] The acquisition module 101 is further specifically configured to acquire text information of hot videos corresponding to keywords without identification based on the target crawling thread.
[0124] Optionally, the processing module 102 is further configured to perform a deduplication operation on the text information based on the acquired text information to obtain text information after the deduplication operation.
[0125] The acquisition module 101 is further specifically configured to obtain the video data of each hot video based on the text information after the deduplication operation.
[0126] Optionally, the video data acquisition device 10 further includes a deleting module 103 .
[0127] The deletion module 103 is configured to delete the text information of the first hot video or the text information of the second hot video when the difference between the duration of the first hot video and the duration of the second hot video is less than a duration difference threshold, or when the similarity between the cover data of the first hot video and the cover data of the second hot video is greater than a similarity threshold, wherein the first hot video is one of the multiple hot videos corresponding to each keyword, and the second hot video is one of the multiple hot videos except the first hot video.
[0128] Optionally, the processing module 102 is further configured to store the text information of the hot video corresponding to each keyword into a database.
[0129] As described above, the embodiment of the present disclosure can divide the functional modules of the video data acquisition device according to the above method example. Among them, the above integrated modules can be implemented in the form of hardware or in the form of software functional modules. In addition, it should be noted that the division of modules in the embodiment of the present disclosure is schematic and is only a logical function division. There may be other division methods in actual implementation. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module.
[0130] Regarding the video data acquisition device in the above embodiment, the specific manner in which each module performs operations and the beneficial effects thereof have been described in detail in the above method embodiment and will not be repeated here.
[0131] Fig. 9 FIG. 1 is a schematic diagram of another video data acquisition device provided by the present disclosure. Fig. 9 The video data acquisition device 20 may include at least one processor 201 and a memory 203 for storing processor executable instructions. The processor 201 is configured to execute instructions in the memory 203 to implement the video data acquisition method in the above embodiment.
[0132] In addition, the video data acquisition device 20 may further include a communication bus 202 and at least one communication interface 204 .
[0133] The processor 201 may be a central processing unit (CPU), a microprocessing unit, an ASIC, or one or more integrated circuits for controlling the execution of the program of the disclosed solution.
[0134] The communication bus 202 may include a pathway for transmitting information between the above-mentioned components.
[0135] The communication interface 204 uses any transceiver or other device for communicating with other devices or communication networks, such as Ethernet, radio access network (RAN), wireless local area networks (WLAN), etc.
[0136] The memory 203 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory may exist independently and be connected to the processing unit through a bus. The memory may also be integrated with the processing unit.
[0137] The memory 203 is used to store instructions for executing the solution of the present disclosure, and the execution is controlled by the processor 201. The processor 201 is used to execute the instructions stored in the memory 203, so as to realize the functions in the method of the present disclosure.
[0138] In a specific implementation, as an embodiment, the processor 201 may include one or more CPUs, such as Fig. 9 CPU0 and CPU1 in.
[0139] In a specific implementation, as an embodiment, the video data acquisition device 20 may include multiple processors, such as Fig. 9 201 and processor 207 in the embodiment of the present invention. Each of these processors may be a single-CPU processor or a multi-CPU processor. The processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).
[0140] In a specific implementation, as an embodiment, the video data acquisition device 20 may further include an output device 205 and an input device 206. The output device 205 communicates with the processor 201 and may display information in a variety of ways. For example, the output device 205 may be a liquid crystal display (LCD), a light emitting diode (LED) display device, a cathode ray tube (CRT) display device, or a projector. The input device 206 communicates with the processor 201 and may receive user input in a variety of ways. For example, the input device 206 may be a mouse, a keyboard, a touch screen device, or a sensor device.
[0141] Those skilled in the art will understand that Fig. 9 The structure shown in the figure does not constitute a limitation on the video data acquisition device 20, and may include more or less components than those shown in the figure, or combine certain components, or adopt a different component arrangement.
[0142] In addition, the present disclosure also provides a computer-readable storage medium, including instructions, which, when executed by an electronic device, enable the electronic device to execute the video data acquisition method provided in the above embodiment.
[0143] In addition, the present disclosure also provides a computer program product, including instructions, which, when executed by an electronic device, enable the electronic device to execute the video data acquisition method provided in the above embodiment.
[0144] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.
Claims
1. A method for acquiring video data, characterized in that: include: Get keywords of multiple hot news; Dividing the keywords of the multiple hot news to obtain N keyword sets, wherein each keyword set includes at least one keyword, and N≥1; Creating a crawling thread for each keyword set to obtain N crawling threads; each of the N crawling threads is configured with a daemon thread; Calling each of the crawling threads to obtain text information of hot videos corresponding to each keyword in each keyword set, wherein each keyword set corresponds to each of the crawling threads; After determining that the text information of the hot video corresponding to the first keyword has been successfully obtained, adding an identifier to the first keyword, the identifier is used to indicate that the text information of the corresponding hot video has been successfully obtained, and the first keyword is a keyword included in each keyword set; In the case that the text information of the hot videos corresponding to all the keywords in each keyword set is not obtained and each of the crawling threads is interrupted, the daemon thread is called to restart each of the crawling threads, and the text information of the hot videos corresponding to the keywords without the identification is obtained based on each of the crawling threads; Based on the obtained text information, video data of the hot video is obtained.
2. The video data acquisition method according to claim 1, characterized in that: The step of obtaining video data of a hot video based on the obtained text information includes: Based on the N capture threads and the acquired text information, the video data of the hot video is obtained.
3. The video data acquisition method according to claim 1 or 2, characterized in that: The step of obtaining video data of a hot video based on the obtained text information includes: Based on the acquired text information, performing a deduplication operation on the text information to obtain text information after the deduplication operation; Based on the text information after the deduplication operation, the video data of each hot video is obtained.
4. The video data acquisition method according to claim 3, characterized in that: The deduplication operation on the text information includes: When the difference between the duration of the first hot video and the duration of the second hot video is less than the duration difference threshold, or when the similarity between the cover data of the first hot video and the cover data of the second hot video is greater than the similarity threshold, the text information of the first hot video or the text information of the second hot video is deleted, the first hot video is one of the multiple hot videos corresponding to each keyword, and the second hot video is one of the multiple hot videos except the first hot video.
5. The video data acquisition method according to claim 1 or 2, characterized in that: The method further comprises: The text information of the hot videos corresponding to each keyword is stored in the database.
6. A video data acquisition device, characterized in that: Includes an acquisition module and a processing module; The acquisition module is configured to acquire keywords of multiple hot news; The processing module is configured to divide the keywords of the multiple hot news to obtain N keyword sets, wherein each keyword set includes at least one keyword, and N≥1; The processing module is further configured to create a crawling thread for each keyword set to obtain N crawling threads; each of the N crawling threads is configured with a daemon thread; The acquisition module is further configured to call each of the crawling threads to acquire text information of hot videos corresponding to each keyword in each keyword set, wherein each keyword set corresponds to each of the crawling threads; The processing module is further configured to, after determining that the text information of the hot video corresponding to the first keyword has been successfully obtained, add an identifier to the first keyword, the identifier being used to indicate that the text information of the corresponding hot video has been successfully obtained, and the first keyword is a keyword included in each keyword set; The processing module is further configured to call the daemon thread to restart each crawling thread when the text information of the hot videos corresponding to all the keywords in each keyword set is not obtained and each crawling thread is interrupted; The acquisition module is further configured to acquire text information of hot videos corresponding to keywords without identification based on each crawling thread; The acquisition module is also configured to acquire video data of the hot video based on the acquired text information.
7. The video data acquisition device according to claim 6, characterized in that: The acquisition module is specifically configured to obtain the video data of the hot video based on the N capture threads and the acquired text information.
8. The video data acquisition device according to claim 6 or 7, characterized in that: The processing module is further configured to perform a deduplication operation on the text information based on the acquired text information to obtain text information after the deduplication operation; The acquisition module is specifically configured to obtain the video data of each hot video based on the text information after the deduplication operation.
9. The video data acquisition device according to claim 8, characterized in that: The video data acquisition device also includes a deletion module; The deletion module is configured to delete the text information of the first hot video or the text information of the second hot video when the difference between the duration of the first hot video and the duration of the second hot video is less than a duration difference threshold, or when the similarity between the cover data of the first hot video and the cover data of the second hot video is greater than a similarity threshold, wherein the first hot video is one of the multiple hot videos corresponding to each keyword, and the second hot video is one of the multiple hot videos other than the first hot video.
10. The video data acquisition device according to claim 6 or 7, characterized in that: The processing module is also configured to store the text information of the hot video corresponding to each keyword into a database.
11. An electronic device, characterized in that: The electronic device comprises: processor; a memory configured to store instructions executable by the processor; The processor is configured to execute the instructions to implement the video data acquisition method according to any one of claims 1 to 5.
12. A computer-readable storage medium having instructions stored thereon, characterized in that: When the instructions in the computer-readable storage medium are executed by an electronic device, the electronic device is enabled to execute the video data acquisition method according to any one of claims 1 to 5.
13. A computer program product, characterized in that The computer program product comprises computer instructions, and when the computer instructions are executed on an electronic device, the electronic device executes the video data acquisition method according to any one of claims 1 to 5.
