WO2017152792A1 - 一种获取网络文件资源的方法、装置及电子设备 - Google Patents

一种获取网络文件资源的方法、装置及电子设备 Download PDF

Info

Publication number
WO2017152792A1
WO2017152792A1 PCT/CN2017/075064 CN2017075064W WO2017152792A1 WO 2017152792 A1 WO2017152792 A1 WO 2017152792A1 CN 2017075064 W CN2017075064 W CN 2017075064W WO 2017152792 A1 WO2017152792 A1 WO 2017152792A1
Authority
WO
WIPO (PCT)
Prior art keywords
data traffic
unit
network file
file resource
video data
Prior art date
Application number
PCT/CN2017/075064
Other languages
English (en)
French (fr)
Inventor
徐光圣
Original Assignee
北京金山安全软件有限公司
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 北京金山安全软件有限公司 filed Critical 北京金山安全软件有限公司
Publication of WO2017152792A1 publication Critical patent/WO2017152792A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9577Optimising the visualization of content, e.g. distillation of HTML documents
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/951Indexing; Web crawling techniques
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]

Definitions

  • the invention relates to a computer network resource technology, in particular to a method, a device and an electronic device for acquiring network file resources.
  • the monthly charging method of traffic packets for example, 10 yuan / 20M / month, 80 yuan / 1G / month, 120 yuan / 2G / year, etc., if the user's traffic in the month does not exceed the monthly subscription For the (year) traffic package, there is no additional charge. If the user's traffic in the month (year) exceeds the monthly (year) traffic packet, the excess will be based on a billing method that is much higher than the monthly billing fee. Billing.
  • the network server When the user is in a paid network scenario, for example, in a 3G or 4G network scenario, currently, such as If the user needs to obtain the network file resource, the network server prompts the user whether to continue to obtain the network file resource. After the user selects and obtains the network file resource, if the data traffic exceeds the preset monthly data traffic threshold, the user is sent to the user. Prompt for the portion of the monthly package data traffic threshold.
  • the method for obtaining network file resources only prompts the user for the excess when the data traffic is exceeded, increases the user's data traffic cost, and improves the user's network cost.
  • the improved method is to query the remaining data traffic by editing a short message or making a call when the network file resource needs to obtain a large capacity, or before, based on the acquired remaining data traffic and
  • the network file resource size determines whether the network file resource needs to be obtained. For example, if the remaining data of the data obtained by the query is 10M, and the current network file resource size is 60M, the network file resource may be discarded, thereby avoiding additional data traffic charges.
  • the improved method for obtaining network file resources requires the user to manually edit the short message or dial the inquiry phone, and query the remaining data traffic according to the voice prompt, which additionally increases the time required for acquiring the network file resource, and the operation is cumbersome, so that the network is acquired. File resources are less efficient and reduce the user's network experience.
  • the embodiments of the present invention provide a method, an apparatus, and an electronic device for acquiring network file resources, which improve the efficiency of acquiring network file resources.
  • an embodiment of the present invention provides a method for acquiring network file resources, including:
  • the video data request carries identifier information that only returns a video data request response header.
  • the network file resource is an mp4 video
  • the parsing is performed according to the video data request response returned by the video data request, and the obtained network file resource size obtained by the parsing includes:
  • the network file resource is an M3U8 video
  • the parsing is performed according to the video data request response returned by the video data request, and the obtained network file resource size obtained by the parsing includes:
  • the network file resource size is calculated by using the following formula:
  • SUM_SIZE is the network file resource size
  • SUM_TIME is the total duration
  • SUB_SUM_SIZE is the total size of the sample
  • SUB_SUM_TIME is the total length of the sample.
  • the triggering to obtain the remaining data traffic includes:
  • the package data traffic threshold is subtracted from the data traffic consumed by the electronic device in the package effective date interval to obtain the remaining data traffic.
  • the method further includes:
  • Extracting system log information recorded by the electronic device, and acquiring data traffic consumed by the electronic device in the effective date range of the package includes:
  • Extracting system log information recorded by the electronic device acquiring data traffic consumed by the electronic device in a valid date range of the package, and storing the stored data traffic information during a time period after the stored time information;
  • the stored data flow information and time information are updated with accumulated data flow information and time information.
  • the triggering to obtain the remaining data traffic includes:
  • the triggering to obtain the remaining data traffic includes:
  • the first remaining data traffic is corrected according to a preset correction policy to obtain a remaining data traffic.
  • an embodiment of the present invention provides an apparatus for acquiring a network file resource, including: a remaining data traffic obtaining module, a network file resource acquiring module, and a network file resource downloading module, where
  • the remaining data traffic obtaining module is configured to send a video data request, trigger to acquire the remaining data traffic, and display the obtained remaining data traffic;
  • a network file resource obtaining module configured to parse a video data request response returned according to the video data request, and obtain and parse the network file resource size obtained by the parsing;
  • a network file resource downloading module configured to receive a download instruction of a webpage output corresponding to the video data request, where the downloading instruction is generated by the user according to the remaining data traffic displayed and the network file resource size, and selecting a network file resource to be downloaded, Download the network file resource to be downloaded.
  • the video data request carries identifier information that only returns a video data request response header.
  • the network file resource is an mp4 video
  • the network file resource obtaining module includes: a first parsing unit and a first information extracting unit, where
  • a first parsing unit configured to parse the video data request response, and obtain a video data request response response header
  • the first information extracting unit is configured to determine whether the content of the video data request response header includes a Content-Length field, and if yes, extract the information after the Content-Length field to obtain a network file resource size.
  • the network file resource is an M3U8 video
  • the network file resource obtaining module includes: a second parsing unit, a judging unit, an accumulating unit, a second information extracting unit, and a network file resource calculating unit, where
  • a second parsing unit configured to parse the video data request response, and obtain an M3U8 file included in the video data request response header
  • the determining unit is configured to determine whether the M3U8 video size information is included in the pre-set position in the M3U8 file, and if so, obtain the network file resource size; if not, the M3U8 file is traversed to obtain the duration information after the EXTINF field;
  • the accumulating unit is configured to accumulate information of each duration to obtain a total duration
  • a second information extracting unit configured to select a predetermined number of transport stream segments in the M3U8 file, initiate an HTTP request, and obtain a total length of samples and a total sample size of the predetermined number of transport stream segments according to the returned HTTP request response;
  • the network file resource calculation unit is configured to calculate a sample transmission rate according to the total size of the sample and the total duration of the sample, and obtain a network file resource size according to the sample transmission rate and the total duration.
  • the network file resource size is calculated by using the following formula:
  • SUM_SIZE is the network file resource size
  • SUM_TIME is the total duration
  • SUB_SUM_SIZE is the total size of the sample
  • SUB_SUM_TIME is the total length of the sample.
  • the remaining data traffic obtaining module includes: a request sending unit, a query unit, an extracting unit, a remaining data traffic acquiring unit, and a display unit, where
  • a request sending unit configured to notify the query unit after sending the video data request
  • the query unit is configured to query the stored package file to obtain a threshold of the data flow of the package
  • An extracting unit configured to extract system log information recorded by the electronic device, and acquire data traffic consumed by the electronic device in a valid date range of the package;
  • the remaining data traffic obtaining unit is configured to subtract the data traffic consumed by the electronic device in the validity date of the package from the threshold data traffic threshold to obtain the remaining data traffic;
  • a display unit configured to display the acquired remaining data traffic.
  • the remaining data traffic obtaining module includes: a request sending unit, a query unit, and a Unit, update unit, storage unit, remaining data flow acquisition unit, and display unit
  • a request sending unit configured to notify the query unit after sending the video data request
  • the query unit is configured to query the stored package file to obtain a threshold of the data flow of the package
  • the accumulating unit is configured to extract system log information recorded by the electronic device, acquire data traffic consumed by the electronic device in a valid date range of the package, and consume the data traffic in the time period after the stored time information, and accumulate the stored data traffic information. ;
  • An update unit configured to update data traffic information and time information stored by the storage unit with accumulated data traffic information and time information
  • a storage unit configured to store the acquired data traffic information and time information, and clear the stored data traffic information and time information after the expiration date interval of the package;
  • the remaining data traffic obtaining unit is configured to subtract the data traffic consumed by the electronic device in the validity date of the package from the threshold data traffic threshold to obtain the remaining data traffic;
  • a display unit configured to display the acquired remaining data traffic.
  • the remaining data traffic obtaining module includes: a request sending unit, a calling unit, and a remaining data traffic extracting unit, where
  • a request sending unit configured to notify the calling unit after sending the video data request
  • the calling unit is configured to trigger a call for the preset traffic query message to be sent to a preset service provider
  • the remaining data traffic extracting unit is configured to receive the short message fed back by the operating service provider, and extract the remaining data traffic therein.
  • the remaining data traffic obtaining module includes: a request sending unit, a threshold query unit, a log information extracting unit, a first remaining data traffic acquiring unit, a short message querying unit, a short message extracting unit, and a correcting unit, where
  • a request sending unit configured to notify a threshold query unit after sending the video data request
  • a threshold query unit configured to query a stored package file, and obtain a threshold data traffic threshold
  • a log information extracting unit configured to extract system log information recorded by the electronic device, and acquire an electronic device Data traffic consumed during the effective date range of the package;
  • a first remaining data traffic obtaining unit configured to subtract the data traffic consumed by the electronic device in a package effective date interval from the package data traffic threshold to obtain a first remaining data traffic
  • the short message query unit is configured to trigger a call for a preset traffic query message to be sent to a preset service provider;
  • a short message extracting unit configured to receive a short message fed back by the operating service provider, and extract a second remaining data traffic therein;
  • the correcting unit is configured to use the second remaining data traffic to correct the first remaining data traffic according to a preset calibration policy to obtain a remaining data traffic.
  • an embodiment of the present invention provides an electronic device, including: a housing, a processor, a memory, a circuit board, and a power supply circuit, wherein the circuit board is disposed inside the space enclosed by the housing, and the processor And a memory disposed on the circuit board; a power supply circuit for powering each circuit or device of the electronic device; a memory for storing executable program code; and the processor operating by reading executable program code stored in the memory A program corresponding to the execution program code, for performing the method for obtaining a network file resource according to any of the foregoing.
  • an embodiment of the present invention provides a computer program product, when the instruction processor in the computer program product executes, performing a method for acquiring a network file resource, where the method includes:
  • an embodiment of the present invention provides a storage medium, when the instructions in the storage medium are executed by a processor of a mobile terminal, enabling the mobile device to perform a method for acquiring network file resources.
  • Method the method comprising:
  • the method, device, and electronic device for acquiring a network file resource provided by the embodiment of the present invention, sending a video data request, triggering acquisition of remaining data traffic, displaying the obtained remaining data traffic, and parsing the video data request returned according to the video data request Responding to obtain the size and display of each network file resource obtained by the parsing; receiving a download instruction outputted by the webpage corresponding to the video data request, where the downloading instruction is that the user selects the network to be downloaded according to the remaining data traffic displayed and the network file resource size. After the file resource is generated, the network file resource to be downloaded is downloaded.
  • FIG. 1 is a schematic flowchart of a method for obtaining network file resources according to an embodiment of the present invention
  • FIG. 2 is a schematic flowchart of triggering acquisition of remaining data traffic according to the first embodiment of the present invention
  • FIG. 3 is a schematic flowchart of triggering acquisition of remaining data traffic according to a second embodiment of the present invention.
  • FIG. 4 is a schematic flowchart of triggering acquisition of remaining data traffic according to a third embodiment of the present invention.
  • FIG. 5 is a schematic flowchart of analyzing the size of each network file resource obtained by parsing the video data request response returned according to the video data request according to the fourth embodiment of the present invention
  • FIG. 6 is a schematic flowchart of analyzing the size of each network file resource obtained by the parsing according to the video data request response returned by the video data request according to the fifth embodiment of the present invention
  • FIG. 7 is a schematic structural diagram of an apparatus for acquiring network file resources according to an embodiment of the present invention.
  • FIG. 8 is a schematic structural diagram of an embodiment of an electronic device according to the present invention.
  • FIG. 1 is a schematic flowchart of a method for obtaining network file resources according to an embodiment of the present invention. Referring to Figure 1, the method includes:
  • Step 11 Send a video data request, trigger to acquire remaining data traffic, and display the obtained remaining data traffic;
  • the webpage information is input in the address access field of the browser, for example, Hypertext Transfer Protocol (HTTP) information or Uniform Resource Locator (URL) information or The Internet Protocol (IP) address information triggers the output of the video data request to the browser.
  • HTTP Hypertext Transfer Protocol
  • URL Uniform Resource Locator
  • IP Internet Protocol
  • the browser After receiving the video data request, the browser sends a corresponding webpage (web server) to the video data request for subsequent related processing. For example, if the user needs to watch the movie online, the video data request is sent to the webpage where the movie is located to obtain the movie information contained in the webpage, and the remaining data traffic is triggered.
  • the method may further include:
  • the network file resource if any, performs the step of triggering the acquisition of remaining data traffic.
  • the webpage corresponding to the video data request does not include a network file resource that exceeds a preset data threshold, it indicates that the user does not directly generate user network traffic even if the network file resource in the webpage is directly obtained.
  • the impact, and thus, can be handled in accordance with prior art processes.
  • the network file resource included in the webpage may be one of the largest network file resources, and may be all the network file resources included in the webpage, which is not limited by the embodiment of the present invention.
  • the data threshold may be set according to actual needs. For example, for the monthly subscription or the annual subscription of the user, if the threshold of the data flow of the package is large, the data threshold may be set higher; if the threshold of the data flow of the package is small , you can set a correspondingly smaller data threshold.
  • FIG. 2 is a schematic flowchart of triggering acquisition of remaining data traffic according to the first embodiment of the present invention. Referring to Figure 2, the process includes:
  • Step 21 Query the stored package file to obtain a threshold of the data flow of the package
  • the information related to the package is stored in the local storage in the form of a package file, and the browser can obtain the package data traffic threshold by reading the package file.
  • the package file includes: a package data traffic threshold and a package effective date interval. among them,
  • the threshold data traffic threshold includes but is not limited to: monthly package data traffic threshold, quarterly meal data traffic threshold, half-year meal data traffic threshold, annual meal data traffic threshold, and the like.
  • the effective date range of the package can be (01-28/30/31).
  • Step 22 extracting system log information recorded by the electronic device, and acquiring data traffic consumed by the electronic device in the effective date range of the package;
  • the operating system records the hardware and software information of the electronic device in operation in the system log information, and monitors events occurring in the system. For example, record the start time, end time, data flow consumption, power consumption, abnormal events, etc. of each application running. By counting the data traffic consumed by each application in the effective date range of the package, and accumulating, you can Get the data traffic consumed by the electronic device during the effective date range of the package.
  • the method may further include:
  • the acquired data flow information and the time information are stored, and the stored data flow information and the time information are cleared after the package effective date interval.
  • the extracting the system log information recorded by the electronic device, and acquiring the data traffic consumed by the electronic device in the effective date range of the package includes:
  • Extracting system log information recorded by the electronic device acquiring data traffic consumed by the electronic device in a valid date range of the package, and storing the stored data traffic information during a time period after the stored time information;
  • the stored data flow information and time information are updated with accumulated data flow information and time information.
  • Step 23 Subtract the data flow threshold consumed by the electronic device in the package effective date interval from the package data traffic threshold to obtain remaining data traffic.
  • FIG. 3 is a schematic flowchart of triggering acquisition of remaining data traffic according to a second embodiment of the present invention. Referring to Figure 3, the process includes:
  • Step 31 triggering a call for a preset traffic query message to be sent to a preset service provider
  • the pre-edited traffic query short message is automatically triggered and sent to the operation service provider, so that the user does not need to manually input the traffic query every time. SMS, and then browse the returned SMS, and obtain the remaining data traffic, which effectively shortens the time required to obtain network file resources, and improves the efficiency of obtaining network file resources for automatic operation.
  • Step 32 Receive a short message fed back by the service provider, and extract remaining data traffic therein.
  • FIG. 4 is a third embodiment of the present invention.
  • Step 41 Query the stored package file to obtain a threshold of the data flow of the package
  • Step 42 Extract system log information recorded by the electronic device, and obtain data traffic consumed by the electronic device in the effective date range of the package;
  • Step 43 Subtract the data traffic threshold consumed by the electronic device in the effective date of the package from the threshold data traffic threshold to obtain the first remaining data traffic.
  • Step 44 triggering a call for a preset traffic query message to be sent to a preset service provider
  • Step 45 Receive a short message sent by the service provider, and extract a second remaining data traffic.
  • Step 46 Correct the first remaining data traffic according to a preset calibration policy by using the second remaining data traffic to obtain remaining data traffic.
  • the calibration policy may be set according to actual needs, for example, according to the deviation between the first remaining data traffic, the second remaining data traffic, and the data traffic at the time of final deduction, the present invention
  • the embodiment does not limit this.
  • the remaining data traffic may be displayed by using a floating window, a notification bar, or the like.
  • a preset script may be injected into the browser, and the script is used to monitor the browser to automatically acquire the remaining data traffic at the same time as or after the video data request is sent.
  • step 12 the video data request response returned according to the video data request is parsed, and the size of each network file resource obtained by the parsing is obtained and displayed.
  • the video data request is an HTTP request.
  • an HTTP request may carry identifier information that only returns an HTTP response header.
  • the video returned by the web page (server) corresponding to the video data request In the data request response, only the video data request response header is included, and the video data request response body is returned, wherein the video data request response body includes webpage data information of each network file resource size.
  • the network file resource includes: video, audio, picture or animation, and the like.
  • the video may include: mp4 video and M3U8 video.
  • FIG. 5 is a schematic flowchart of obtaining a parsed video data request response according to the video data request, and obtaining the parsed network file resource size according to the fourth embodiment of the present invention. .
  • the process includes:
  • Step 51 Parsing a video data request response, and obtaining a response header of the video data request response;
  • Step 52 Determine whether the video data request response header includes a Content-Length field. If yes, extract the information after the Content-Length field to obtain a network file resource size.
  • the process ends.
  • one or more Content-Length fields may be included, and each Content-Length field corresponds to a network file resource size.
  • HTTP request When sending a video data request (HTTP request) to a webpage (web server), the identifier only returns information of the HTTP response header, and the webpage (web server) does not need to return true mp4 video data when returning the video data request response, and only needs to return
  • the video data request response header (HTTP request response header) is sufficient. Thus, since only the video data request response header is included, and there is no need to transmit the video data request response body, the consumed traffic is negligible.
  • one of the returned video data request response headers is Content-Length, for example, if the "Content-Length:24103302" field information is included, where the Content-Length word
  • the information after the segment indicates the mp4 video size, which is 24,103,302 bytes (B), which is approximately 23 MB.
  • B 24,103,302 bytes
  • FIG. 6 is a flowchart of analyzing the video file request response according to the video data request and obtaining the parsed network file resource size according to the fifth embodiment of the present invention.
  • Step 61 parsing the video data request response, and acquiring the M3U8 file included in the video data request response header;
  • M3U8 is a type of M3U, the encoding format is UTF-8, M3U is encoded with Latin-1 character set, and M3U8 file refers to M3U file in UTF-8 encoding format, which is an index file of text, generally size For a few KB, including a list of played video links, each played video is a TS segment, and each TS segment contains a description of the length of time: EXTINF, in seconds.
  • Step 62 Determine whether the M3U8 video size information is included in the preset position in the M3U8 file, and if so, obtain the network file resource size; if not, traverse the M3U8 file to obtain the duration information after the EXTINF field;
  • each EXTINF field corresponds to a transport stream (TS, Transport Stream) segment, and in the M3U8 file, one or more EXTINF fields may be included.
  • Step 63 accumulating each time length information to obtain a total duration
  • the M3U8 file is traversed, and the duration information corresponding to all TS segments is counted and accumulated to obtain the total duration (SUM_TIME).
  • Step 64 Select a predetermined number of transport stream segments in the M3U8 file, initiate an HTTP request, and obtain a total length of samples and a total sample size of the predetermined number of transport stream segments according to the returned HTTP request response.
  • one or more (predetermined number of) transport stream segments in the M3U8 file are selected to initiate HTTP.
  • Request process the same as the mp4 file, do not play, only get the size of the transport stream segment, sum the size of multiple transport stream segments, get the total sample size (SUB_SUM_SIZE), and accumulate the total sample length of the multiple transport stream segments (SUB_SUM_TIME).
  • the predetermined number may be set according to actual needs, and is less than or equal to the total number of TS segments included in the M3U8 file.
  • Step 65 Calculate a sample transmission rate according to the total size of the sample and the total duration of the sample, and obtain a network file resource size according to the sample transmission rate and the total duration.
  • the network file resource size is calculated by using the following formula:
  • SUM_SIZE is the network file resource size
  • SUM_TIME is the total duration
  • SUB_SUM_SIZE is the total size of the sample
  • SUB_SUM_TIME is the total length of the sample.
  • the network file resource size can be obtained.
  • an example of an M3U8 file is as follows:
  • Step 13 Receive a download instruction outputting the webpage corresponding to the video data request, where the downloading instruction is generated by the user according to the remaining data traffic and the network file resource size, and the network file resource to be downloaded is generated, and the downloading is to be downloaded. Network file resource.
  • the user can select whether to play or cancel the playback according to the size of the two data. If the play is required, the network file resource may be triggered by a corresponding network file resource, and the network file resource to be downloaded may be downloaded. For example, if the displayed user requires a video size of 20M and the remaining data traffic is 500M, the user can choose to play the video; if the remaining data traffic is only 10M, the user can choose not to watch the video.
  • the method for transmitting the video data triggers the acquisition of the remaining data traffic, and displays the obtained remaining data traffic; and parses the video data request response returned according to the video data request, and obtains the parsed network file resource size. And displaying, the downloading instruction outputting the webpage corresponding to the video data request, the downloading instruction is generated by the user according to the remaining data traffic and the network file resource size, and the network file resource to be downloaded is generated, and the downloading is to be downloaded.
  • Network file resource In this way, by automatically acquiring the remaining data traffic and the network file resource size and presenting to the user, the user only needs to select the required network file resource according to the remaining data traffic and the network file resource size.
  • the source downloads effectively shortens the time required to acquire network file resources, simplifies the operation process, and improves the efficiency of acquiring network file resources.
  • FIG. 7 is a schematic structural diagram of an apparatus for acquiring network file resources according to an embodiment of the present invention.
  • the device includes: a remaining data traffic obtaining module 71, a network file resource acquiring module 72, and a network file resource downloading module 73, where
  • the remaining data traffic obtaining module 71 is configured to send a video data request, trigger the acquisition of the remaining data traffic, and display the acquired remaining data traffic;
  • the video data request carries identifier information that only returns a video data request response header.
  • the method may further include:
  • a preset script may be injected into the browser, and the script is used to monitor the browser to automatically acquire the remaining data traffic at the same time as or after the video data request is sent.
  • the remaining data traffic obtaining module 71 includes: a request sending unit, a query unit, an extracting unit, a remaining data traffic acquiring unit, and a display unit (not shown), where
  • a request sending unit configured to notify the query unit after sending the video data request
  • the query unit is configured to query the stored package file to obtain a threshold of the data flow of the package
  • the package file includes: a package data traffic threshold and a package effective date interval. among them,
  • the threshold data traffic threshold includes but is not limited to: monthly package data traffic threshold, quarterly meal data traffic threshold, half-year meal data traffic threshold, annual meal data traffic threshold, and the like.
  • An extracting unit configured to extract system log information recorded by the electronic device, and acquire an electronic device in the package Data traffic consumed during the effective date range;
  • the remaining data traffic obtaining unit is configured to subtract the data traffic consumed by the electronic device in the validity date of the package from the threshold data traffic threshold to obtain the remaining data traffic;
  • a display unit configured to display the acquired remaining data traffic.
  • the remaining data traffic may be displayed by using a floating window, a notification bar, or the like.
  • the remaining data traffic obtaining module 71 includes: a request sending unit, a query unit, an accumulating unit, an updating unit, a storage unit, a remaining data traffic acquiring unit, and a display unit.
  • a request sending unit configured to notify the query unit after sending the video data request
  • the query unit is configured to query the stored package file to obtain a threshold of the data flow of the package
  • the accumulating unit is configured to extract system log information recorded by the electronic device, acquire data traffic consumed by the electronic device in a valid date range of the package, and consume the data traffic in the time period after the stored time information, and accumulate the stored data traffic information. ;
  • An update unit configured to update data traffic information and time information stored by the storage unit with accumulated data traffic information and time information
  • a storage unit configured to store the acquired data traffic information and time information, and clear the stored data traffic information and time information after the expiration date interval of the package;
  • the remaining data traffic obtaining unit is configured to subtract the data traffic consumed by the electronic device in the validity date of the package from the threshold data traffic threshold to obtain the remaining data traffic;
  • a display unit configured to display the acquired remaining data traffic.
  • the remaining data traffic obtaining module 71 includes: a request sending unit, a calling unit, and a remaining data traffic extracting unit, where
  • a request sending unit configured to notify the calling unit after sending the video data request
  • the calling unit is configured to trigger a call for the preset traffic query message to be sent to a preset service provider
  • the pre-edited traffic query short message is automatically triggered and sent to the service provider.
  • the remaining data traffic extracting unit is configured to receive the short message fed back by the operating service provider, and extract the remaining data traffic therein.
  • the remaining data traffic obtaining module 71 includes: a request sending unit, a threshold query unit, a log information extracting unit, a first remaining data traffic acquiring unit, a short message querying unit, a short message extracting unit, and a correcting unit, where
  • a request sending unit configured to notify a threshold query unit after sending the video data request
  • a threshold query unit configured to query a stored package file, and obtain a threshold data traffic threshold
  • the log information extracting unit is configured to extract system log information recorded by the electronic device, and acquire data traffic consumed by the electronic device in the effective date range of the package;
  • a first remaining data traffic obtaining unit configured to subtract the data traffic consumed by the electronic device in a package effective date interval from the package data traffic threshold to obtain a first remaining data traffic
  • the short message query unit is configured to trigger a call for a preset traffic query message to be sent to a preset service provider;
  • a short message extracting unit configured to receive a short message fed back by the operating service provider, and extract a second remaining data traffic therein;
  • the correcting unit is configured to use the second remaining data traffic to correct the first remaining data traffic according to a preset calibration policy to obtain a remaining data traffic.
  • the network file resource obtaining module 72 is configured to parse the video data request response returned according to the video data request, and obtain the parsed network file resource size and display the network file resource;
  • the network file resource includes: video, audio, picture or animation, and the like.
  • the video may include: mp4 video and M3U8 video.
  • the network file resource is an mp4 video
  • the network file resource obtaining module 72 includes: a first parsing unit and a first information extracting unit (not shown), where
  • a first parsing unit configured to parse the video data request response, and obtain a video data request response response header
  • the first information extracting unit is configured to determine whether the content of the video data request response header includes a Content-Length field, and if yes, extract the information after the Content-Length field to obtain a network file resource size.
  • the process ends.
  • one or more Content-Length fields may be included, and each Content-Length field corresponds to a network file resource size.
  • the network file resource is an M3U8 video
  • the network file resource obtaining module 72 includes: a second parsing unit, a judging unit, an accumulating unit, a second information extracting unit, and a network file. a resource calculation unit (not shown), wherein
  • a second parsing unit configured to parse the video data request response, and obtain an M3U8 file included in the video data request response header
  • the determining unit is configured to determine whether the M3U8 video size information is included in the pre-set position in the M3U8 file, and if so, obtain the network file resource size; if not, the M3U8 file is traversed to obtain the duration information after the EXTINF field;
  • each EXTINF field corresponds to a transport stream (TS, Transport Stream) segment, and in the M3U8 file, one or more EXTINF fields may be included.
  • the accumulating unit is configured to accumulate information of each duration to obtain a total duration
  • a second information extracting unit configured to select a predetermined number of transport stream segments in the M3U8 file, initiate an HTTP request, and obtain a total length of samples and a total sample size of the predetermined number of transport stream segments according to the returned HTTP request response;
  • the network file resource calculation unit is configured to calculate a sample transmission rate according to the total size of the sample and the total duration of the sample, and obtain a network file resource size according to the sample transmission rate and the total duration.
  • the network file resource size is calculated by using the following formula:
  • SUM_SIZE is the network file resource size
  • SUM_TIME is the total duration
  • SUB_SUM_SIZE is the total size of the sample
  • SUB_SUM_TIME is the total length of the sample.
  • the network file resource downloading module 73 is configured to receive a download instruction of the webpage output corresponding to the video data request, where the downloading instruction is generated by the user according to the remaining data traffic displayed and the network file resource size, and the network file resource to be downloaded is selected. Download the network file resource to be downloaded.
  • An embodiment of the present invention further provides an electronic device, where the electronic device includes the device described in any of the foregoing embodiments.
  • FIG. 8 is a schematic structural diagram of an embodiment of an electronic device according to the present invention, which can implement the process of the embodiment shown in FIG. 1-7 of the present invention.
  • the electronic device may include: a housing 81, a processor 82, and a memory.
  • the circuit board 84 is disposed inside the space enclosed by the housing 81, the processor 82 and the memory 83 are disposed on the circuit board 84; and the power supply circuit 85 is used for the electronic device
  • the memory 83 is for storing executable program code
  • the processor 82 runs a program corresponding to the executable program code by reading the executable program code stored in the memory 83 for performing any of the foregoing embodiments The method for obtaining network file resources.
  • the electronic device exists in a variety of forms including, but not limited to:
  • Mobile communication devices These devices are characterized by mobile communication functions and are mainly aimed at providing voice and data communication.
  • Such terminals include: smart phones (such as iPhone), multimedia phones, functional phones, and low-end phones.
  • Ultra-mobile personal computer equipment This type of equipment belongs to the category of personal computers, has computing and processing functions, and generally has mobile Internet access.
  • Such terminals include: PDA, MID and UMPC Equipment, etc., such as an iPad.
  • Portable entertainment devices These devices can display and play multimedia content. Such devices include: audio, video players (such as iPod), handheld game consoles, e-books, and smart toys and portable car navigation devices.
  • the server consists of a processor, a hard disk, a memory, a system bus, etc.
  • the server is similar to a general-purpose computer architecture, but because of the need to provide highly reliable services, processing power and stability High reliability in terms of reliability, security, scalability, and manageability.
  • the storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)
  • Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)

Abstract

一种获取网络文件资源的方法、装置及电子设备。方法包括:发送视频数据请求,触发获取剩余数据流量,展示获取的所述剩余数据流量(11);解析依据所述视频数据请求返回的视频数据请求响应,获取解析得到的各网络文件资源大小并展示(12);接收所述视频数据请求对应的网页输出的下载指令,所述下载指令为用户依据展示的剩余数据流量以及网络文件资源大小,选取待下载网络文件资源后生成的,下载所述待下载网络文件资源(13)。可以提升获取网络文件资源的效率。

Description

一种获取网络文件资源的方法、装置及电子设备
相关申请的交叉引用
本申请要求北京金山安全软件有限公司于2016年3月7日提交的、发明名称为“一种获取网络文件资源的方法、装置及电子设备”的、中国专利申请号“201610126328.7”的优先权。
技术领域
本发明涉及计算机网络资源技术,尤其涉及一种获取网络文件资源的方法、装置及电子设备。
背景技术
随着计算机通信以及互联网技术的不断发展,电子设备的应用越来越普遍,例如,智能移动电话、个人数字助理、掌上电脑以及台式机电脑得到了越来越广泛的应用,同时,安装在电子设备中的网络类应用程序(APP,Application)也越来越多,例如QQ、微信、Whatsapp、Facebook、Line等即时通信(IM,Instant Messaging)应用程序。由于每一网络应用程序在运行中都会消耗用户的流量资源,尤其是用户通过网络应用程序下载或在线浏览视频、图片或动画等数据流量大的网络文件资源时,需要消耗较多的流量资源,而流量资源需要用户以预付费或后付费的方式获取,因而,在应用网络类应用程序时,对网络成本的考量是用户比较关注的话题。
目前,大多数用户采用的是流量包的包月计费方式,例如,10元/20M/月、80元/1G/月、120元/2G/年等,如果用户在该月的流量未超出包月(年)的流量包,则无需再额外付费,如果用户在该月(年)的流量超出包月(年)的流量包,超出的部分将按照比包月流量计费高得多的计费方式进行计费。
对于用户处于付费网络场景时,例如,在3G或4G网络场景下,目前,如 果用户需要获取网络文件资源,网络服务器会提示用户是否需要继续获取该网络文件资源,在用户选取是并获取该网络文件资源后,如果数据流量超过预先设置的月套餐数据流量阈值,则向用户提示超出月套餐数据流量阈值的部分。但该获取网络文件资源的方法,只有在数据流量超出后,才会提示用户超出的部分,增加了用户的数据流量费用,提升了用户的网络成本。
为了避免增加额外的数据流量费用,改进的方法是用户在需要获取容量较大的网络文件资源时或之前,通过编辑短信或拨打电话的方式查询剩余数据流量,然后,基于获取的剩余数据流量以及网络文件资源大小确定是否需要获取该网络文件资源。例如,如果查询得到的数据剩余流量为10M,而当前网络文件资源大小为60M,则可以放弃获取该网络文件资源,从而避免额外增加数据流量费用。但该改进的获取网络文件资源的方法,需要用户手动编辑短信或拨打查询电话,按照语音提示查询到剩余数据流量,额外增加了获取网络文件资源所需的时间,且操作较为繁琐,使得获取网络文件资源的效率较低,降低了用户的网络体验。
发明内容
有鉴于此,本发明实施例提供一种获取网络文件资源的方法、装置及电子设备,提升获取网络文件资源的效率。
为达到上述目的,本发明的实施例采用如下技术方案:
第一方面,本发明实施例提供一种获取网络文件资源的方法,包括:
发送视频数据请求,触发获取剩余数据流量,展示获取的所述剩余数据流量;
解析依据所述视频数据请求返回的视频数据请求响应,获取解析得到的各网络文件资源大小并展示;
接收所述视频数据请求对应的网页输出的下载指令,所述下载指令为用户依据展示的剩余数据流量以及网络文件资源大小,选取待下载网络文件资源后 生成的,下载所述待下载网络文件资源。
可选的,所述视频数据请求中携带有仅返回视频数据请求响应头的标识信息。
可选的,所述网络文件资源为mp4视频,所述解析依据所述视频数据请求返回的视频数据请求响应,获取解析得到的各网络文件资源大小包括:
解析视频数据请求响应,获取视频数据请求响应响应头;
判断所述视频数据请求响应头中是否包含Content-Length字段,如果是,提取Content-Length字段后的信息,得到网络文件资源大小。
可选的,所述网络文件资源为M3U8视频,所述解析依据所述视频数据请求返回的视频数据请求响应,获取解析得到的各网络文件资源大小包括:
解析视频数据请求响应,获取视频数据请求响应头中包含的M3U8文件;
判断M3U8文件中预先设置的位置处是否包含M3U8视频大小信息,如果包含,得到网络文件资源大小;如果不包含,遍历M3U8文件,获取EXTINF字段后的时长信息;
累加各时长信息,得到总时长;
选取M3U8文件中预定数量的传输流段,发起HTTP请求,依据返回的HTTP请求响应获取所述预定数量的传输流段的样本总时长以及样本总大小;
依据所述样本总大小以及样本总时长计算样本传输速率,依据所述样本传输速率以及所述总时长得到网络文件资源大小。
可选的,利用下式计算所述网络文件资源大小:
Figure PCTCN2017075064-appb-000001
式中,
SUM_SIZE为网络文件资源大小;
SUM_TIME为总时长;
SUB_SUM_SIZE为样本总大小;
SUB_SUM_TIME为样本总时长。
可选的,所述触发获取剩余数据流量包括:
查询存储的套餐文件,获取套餐数据流量阈值;
提取电子设备记录的系统日志信息,获取电子设备在套餐有效日期区间内消耗的数据流量;
将所述套餐数据流量阈值减去所述电子设备在套餐有效日期区间内消耗的数据流量,得到剩余数据流量。
可选的,所述方法还包括:
存储获取的数据流量信息以及时间信息,在所述套餐有效日期区间到后,清空存储的数据流量信息以及时间信息;
所述提取电子设备记录的系统日志信息,获取电子设备在套餐有效日期区间内消耗的数据流量包括:
提取电子设备记录的系统日志信息,获取电子设备在套餐有效日期区间内,且在存储的所述时间信息之后的时间段内消耗的数据流量,累计所述存储的数据流量信息;
以累计的数据流量信息及时间信息更新存储的数据流量信息以及时间信息。
可选的,所述触发获取剩余数据流量包括:
触发调用预先设置的流量查询短信,向预先设置的运营服务商发送;
接收所述运营服务商反馈的短信,提取其中的剩余数据流量。
可选的,所述触发获取剩余数据流量包括:
查询存储的套餐文件,获取套餐数据流量阈值;
提取电子设备记录的系统日志信息,获取电子设备在套餐有效日期区间内消耗的数据流量;
将所述套餐数据流量阈值减去所述电子设备在套餐有效日期区间内消耗的数据流量,得到第一剩余数据流量;
触发调用预先设置的流量查询短信,向预先设置的运营服务商发送;
接收所述运营服务商反馈的短信,提取其中的第二剩余数据流量;
利用所述第二剩余数据流量,按照预先设置的校正策略,对所述第一剩余数据流量进行校正,得到剩余数据流量。
第二方面,本发明实施例提供一种获取网络文件资源的装置,包括:剩余数据流量获取模块、网络文件资源获取模块以及网络文件资源下载模块,其中,
剩余数据流量获取模块,用于发送视频数据请求,触发获取剩余数据流量,展示获取的所述剩余数据流量;
网络文件资源获取模块,用于解析依据所述视频数据请求返回的视频数据请求响应,获取解析得到的各网络文件资源大小并展示;
网络文件资源下载模块,用于接收所述视频数据请求对应的网页输出的下载指令,所述下载指令为用户依据展示的剩余数据流量以及网络文件资源大小,选取待下载网络文件资源后生成的,下载所述待下载网络文件资源。
可选的,所述视频数据请求中携带有仅返回视频数据请求响应头的标识信息。
可选的,所述网络文件资源为mp4视频,所述网络文件资源获取模块包括:第一解析单元以及第一信息提取单元,其中,
第一解析单元,用于解析视频数据请求响应,获取视频数据请求响应响应头;
第一信息提取单元,用于判断所述视频数据请求响应头中是否包含Content-Length字段,如果是,提取Content-Length字段后的信息,得到网络文件资源大小。
可选的,所述网络文件资源为M3U8视频,所述网络文件资源获取模块包括:第二解析单元、判断单元、累加单元、第二信息提取单元以及网络文件资源计算单元,其中,
第二解析单元,用于解析视频数据请求响应,获取视频数据请求响应头中包含的M3U8文件;
判断单元,用于判断M3U8文件中预先设置的位置处是否包含M3U8视频大小信息,如果包含,得到网络文件资源大小;如果不包含,遍历M3U8文件,获取EXTINF字段后的时长信息;
累加单元,用于累加各时长信息,得到总时长;
第二信息提取单元,用于选取M3U8文件中预定数量的传输流段,发起HTTP请求,依据返回的HTTP请求响应获取所述预定数量的传输流段的样本总时长以及样本总大小;
网络文件资源计算单元,用于依据所述样本总大小以及样本总时长计算样本传输速率,依据所述样本传输速率以及所述总时长得到网络文件资源大小。
可选的,利用下式计算所述网络文件资源大小:
Figure PCTCN2017075064-appb-000002
式中,
SUM_SIZE为网络文件资源大小;
SUM_TIME为总时长;
SUB_SUM_SIZE为样本总大小;
SUB_SUM_TIME为样本总时长。
可选的,所述剩余数据流量获取模块包括:请求发送单元、查询单元、提取单元、剩余数据流量获取单元以及展示单元,其中,
请求发送单元,用于在发送视频数据请求后,通知查询单元;
查询单元,用于查询存储的套餐文件,获取套餐数据流量阈值;
提取单元,用于提取电子设备记录的系统日志信息,获取电子设备在套餐有效日期区间内消耗的数据流量;
剩余数据流量获取单元,用于将所述套餐数据流量阈值减去所述电子设备在套餐有效日期区间内消耗的数据流量,得到剩余数据流量;
展示单元,用于展示获取的所述剩余数据流量。
可选的,所述剩余数据流量获取模块包括:请求发送单元、查询单元、累 计单元、更新单元、存储单元、剩余数据流量获取单元以及展示单元
请求发送单元,用于在发送视频数据请求后,通知查询单元;
查询单元,用于查询存储的套餐文件,获取套餐数据流量阈值;
累计单元,用于提取电子设备记录的系统日志信息,获取电子设备在套餐有效日期区间内,且在存储的所述时间信息之后的时间段内消耗的数据流量,累计所述存储的数据流量信息;
更新单元,用于以累计的数据流量信息及时间信息更新存储单元存储的数据流量信息以及时间信息;
存储单元,用于存储获取的数据流量信息以及时间信息,在所述套餐有效日期区间到后,清空存储的数据流量信息以及时间信息;
剩余数据流量获取单元,用于将所述套餐数据流量阈值减去所述电子设备在套餐有效日期区间内消耗的数据流量,得到剩余数据流量;
展示单元,用于展示获取的所述剩余数据流量。
可选的,所述剩余数据流量获取模块包括:请求发送单元、调用单元以及剩余数据流量提取单元,其中,
请求发送单元,用于在发送视频数据请求后,通知调用单元;
调用单元,用于触发调用预先设置的流量查询短信,向预先设置的运营服务商发送;
剩余数据流量提取单元,用于接收所述运营服务商反馈的短信,提取其中的剩余数据流量。
可选的,所述剩余数据流量获取模块包括:请求发送单元、阈值查询单元、日志信息提取单元、第一剩余数据流量获取单元、短信查询单元、短信提取单元以及校正单元,其中,
请求发送单元,用于在发送视频数据请求后,通知阈值查询单元;
阈值查询单元,用于查询存储的套餐文件,获取套餐数据流量阈值;
日志信息提取单元,用于提取电子设备记录的系统日志信息,获取电子设 备在套餐有效日期区间内消耗的数据流量;
第一剩余数据流量获取单元,用于将所述套餐数据流量阈值减去所述电子设备在套餐有效日期区间内消耗的数据流量,得到第一剩余数据流量;
短信查询单元,用于触发调用预先设置的流量查询短信,向预先设置的运营服务商发送;
短信提取单元,用于接收所述运营服务商反馈的短信,提取其中的第二剩余数据流量;
校正单元,用于利用所述第二剩余数据流量,按照预先设置的校正策略,对所述第一剩余数据流量进行校正,得到剩余数据流量。
第三方面,本发明实施例提供一种电子设备,所述电子设备包括:壳体、处理器、存储器、电路板和电源电路,其中,电路板安置在壳体围成的空间内部,处理器和存储器设置在电路板上;电源电路,用于为上述电子设备的各个电路或器件供电;存储器用于存储可执行程序代码;处理器通过读取存储器中存储的可执行程序代码来运行与可执行程序代码对应的程序,用于执行前述任一所述的获取网络文件资源的方法。
第四方面,本发明实施例提供一种计算机程序产品,当所述计算机程序产品中的指令处理器执行时,执行一种获取网络文件资源的方法,所述方法包括:
发送视频数据请求,触发获取剩余数据流量,展示获取的所述剩余数据流量;
解析依据所述视频数据请求返回的视频数据请求响应,获取解析得到的各网络文件资源大小并展示;
接收所述视频数据请求对应的网页输出的下载指令,所述下载指令为用户依据展示的剩余数据流量以及网络文件资源大小,选取待下载网络文件资源后生成的,下载所述待下载网络文件资源。
第五方面,本发明实施例提供一种存储介质,当所述存储介质中的指令由移动终端的处理器被执行时,使得移动设备能够执行一种获取网络文件资源的 方法,所述方法包括:
发送视频数据请求,触发获取剩余数据流量,展示获取的所述剩余数据流量;
解析依据所述视频数据请求返回的视频数据请求响应,获取解析得到的各网络文件资源大小并展示;
接收所述视频数据请求对应的网页输出的下载指令,所述下载指令为用户依据展示的剩余数据流量以及网络文件资源大小,选取待下载网络文件资源后生成的,下载所述待下载网络文件资源。
本发明实施例提供的获取网络文件资源的方法、装置及电子设备,发送视频数据请求,触发获取剩余数据流量,展示获取的所述剩余数据流量;解析依据所述视频数据请求返回的视频数据请求响应,获取解析得到的各网络文件资源大小并展示;接收所述视频数据请求对应的网页输出的下载指令,所述下载指令为用户依据展示的剩余数据流量以及网络文件资源大小,选取待下载网络文件资源后生成的,下载所述待下载网络文件资源。这样,通过自动获取剩余数据流量以及网络文件资源大小并向用户展示,用户只需依据剩余数据流量以及网络文件资源大小选取所需的网络文件资源进行下载,有效缩短了获取网络文件资源所需的时间,简化了操作流程,提升了获取网络文件资源的效率。
附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其它的附图。
图1为本发明实施例获取网络文件资源的方法流程示意图;
图2为本发明第一实施例触发获取剩余数据流量的流程示意图;
图3为本发明第二实施例触发获取剩余数据流量的流程示意图;
图4为本发明第三实施例触发获取剩余数据流量的流程示意图;
图5为本发明第四实施例解析依据所述视频数据请求返回的视频数据请求响应,获取解析得到的各网络文件资源大小的流程示意图;
图6为本发明第五实施例解析依据所述视频数据请求返回的视频数据请求响应,获取解析得到的各网络文件资源大小的流程示意图;
图7为本发明实施例获取网络文件资源的装置结构示意图;
图8为本发明电子设备一个实施例的结构示意图。
具体实施方式
下面结合附图对本发明实施例进行详细描述。
应当明确,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其它实施例,都属于本发明保护的范围。
图1为本发明实施例获取网络文件资源的方法流程示意图。参见图1,该方法包括:
步骤11,发送视频数据请求,触发获取剩余数据流量,展示获取的所述剩余数据流量;
本步骤中,用户浏览网页时,通过在浏览器的地址访问栏中输入网页信息,例如,超文本传输协议(HTTP,HyperText Transfer Protocol)信息或统一资源定位符(URL,Uniform Resource Locator)信息或网际协议(IP,Internet Protocol)地址信息,从而触发向浏览器输出视频数据请求,浏览器接收视频数据请求后,向视频数据请求对应的网页(网络服务器)发送以进行后续相关处理。例如,如果用户需要在线观看电影,则向电影所在的网页发送视频数据请求,以获取网页中包含的各电影信息,同时触发获取剩余数据流量。
作为一可选实施例,在所述发送视频数据请求之后,触发获取剩余数据流量之前,该方法还可以包括:
判断所述视频数据请求对应的网页中是否包含有超过预先设置的数据阈值 的网络文件资源,如果有,执行所述触发获取剩余数据流量的步骤。
本步骤中,如果所述视频数据请求对应的网页中未包含有超过预先设置的数据阈值的网络文件资源,则表明用户即使直接获取该网页中的网络文件资源,也不会对用户流量产生多大的影响,因而,可以按照现有技术流程进行处理。其中,网页中包含的网络文件资源,可以是其中一个最大的网络文件资源,也可以是该网页中包含的所有网络文件资源,本发明实施例对此不作限定。
本发明实施例中,数据阈值可以根据实际需要进行设置,例如,对于用户的包月套餐或年套餐,如果套餐数据流量阈值较大,可以将数据阈值设置的较高;如果套餐数据流量阈值较小,可以设置相应较小的数据阈值。
作为一可选实施例,图2为本发明第一实施例触发获取剩余数据流量的流程示意图。参见图2,该流程包括:
步骤21,查询存储的套餐文件,获取套餐数据流量阈值;
本步骤中,当用户通过运营商设置了套餐后,将与套餐相关的信息以套餐文件的形式存储至本地存储器中,浏览器通过读取该套餐文件,可以获取套餐数据流量阈值。
本发明实施例中,作为一可选实施例,套餐文件包括:套餐数据流量阈值以及套餐有效日期区间。其中,
套餐数据流量阈值包括但不限于:月套餐数据流量阈值、季度餐数据流量阈值、半年餐数据流量阈值、年餐数据流量阈值等。对应于月套餐数据流量阈值,套餐有效日期区间可以是(01-28/30/31)。
步骤22,提取电子设备记录的系统日志信息,获取电子设备在套餐有效日期区间内消耗的数据流量;
本步骤中,在电子设备的运行中,操作系统会在系统日志信息中记录电子设备在运行中硬件、软件的信息,监视系统中发生的事件。例如,记录各应用程序运行的开始时间、结束时间、数据流量消耗、电量消耗、异常事件等。通过统计各应用程序在套餐有效日期区间内消耗的数据流量,并进行累加,可以 得到电子设备在套餐有效日期区间内消耗的数据流量。
作为一可选实施例,由于系统日志信息记录的时间区间有限,该方法还可以包括:
存储获取的数据流量信息以及时间信息,在所述套餐有效日期区间到后,清空存储的数据流量信息以及时间信息。则所述提取电子设备记录的系统日志信息,获取电子设备在套餐有效日期区间内消耗的数据流量包括:
提取电子设备记录的系统日志信息,获取电子设备在套餐有效日期区间内,且在存储的所述时间信息之后的时间段内消耗的数据流量,累计所述存储的数据流量信息;
以累计的数据流量信息及时间信息更新存储的数据流量信息以及时间信息。
步骤23,将所述套餐数据流量阈值减去所述电子设备在套餐有效日期区间内消耗的数据流量,得到剩余数据流量。
作为另一可选实施例,图3为本发明第二实施例触发获取剩余数据流量的流程示意图。参见图3,该流程包括:
步骤31,触发调用预先设置的流量查询短信,向预先设置的运营服务商发送;
本步骤中,由于流量查询短信的代码一般是固定的,对于每一电子设备,网络对应的运营服务商也是确定的。因而,本发明实施例中,通过预先设置流量查询短信,在接收到视频数据请求后,自动触发调用预编辑的流量查询短信,向运营服务商发送,从而无需用户每次都需要手动输入流量查询短信,再通过浏览返回的短信,并从中获取剩余数据流量,有效缩短了获取网络文件资源所需的时间,且为自动操作,提升了获取网络文件资源的效率。
步骤32,接收所述运营服务商反馈的短信,提取其中的剩余数据流量。
本发明实施例中,还可以利用短信查询到的数据流量对系统日志信息查询到的数据流量进行校正。因而,作为再一可选实施例,图4为本发明第三实施 例触发获取剩余数据流量的流程示意图。参见图4,该流程包括:
步骤41,查询存储的套餐文件,获取套餐数据流量阈值;
步骤42,提取电子设备记录的系统日志信息,获取电子设备在套餐有效日期区间内消耗的数据流量;
步骤43,将所述套餐数据流量阈值减去所述电子设备在套餐有效日期区间内消耗的数据流量,得到第一剩余数据流量;
步骤44,触发调用预先设置的流量查询短信,向预先设置的运营服务商发送;
步骤45,接收所述运营服务商反馈的短信,提取其中的第二剩余数据流量;
步骤46,利用所述第二剩余数据流量,按照预先设置的校正策略,对所述第一剩余数据流量进行校正,得到剩余数据流量。
本发明实施例中,校正策略可依据实际需要进行设置,例如,可依据多次统计的第一剩余数据流量,第二剩余数据流量以及最终扣费时的数据流量之间的偏差进行设置,本发明实施例对此不作限定。
本发明实施例中,作为一可选实施例,可以通过悬浮窗、通知栏等方式展示剩余数据流量。
本发明实施例中,作为一可选实施例,可以通过在浏览器中注入预先设置的脚本,该脚本用于监测浏览器在发送视频数据请求的同时或之后,触发自动获取剩余数据流量。
步骤12,解析依据所述视频数据请求返回的视频数据请求响应,获取解析得到的各网络文件资源大小并展示;
本步骤中,对于直播的网络文件资源,由于不能获知其播放时长以及大小等相关信息,其处理流程可按照现有技术进行处理。
本发明实施例中,作为一可选实施例,视频数据请求为HTTP请求。实际应用中,为了有效减少网络流量,可以在HTTP请求中,携带有仅返回HTTP响应头的标识信息。因而,在视频数据请求对应的网页(服务器)返回的视频 数据请求响应中,仅包括视频数据请求响应头,而不用返回视频数据请求响应体,其中,视频数据请求响应体中,包含有各网络文件资源大小的网页数据信息。
作为一可选实施例,网络文件资源包括:视频、音频、图片或动画等。其中,以视频为例,可以包括:mp4视频以及M3U8视频。
作为一可选实施例,如果网络文件资源为mp4视频,图5为本发明第四实施例解析依据所述视频数据请求返回的视频数据请求响应,获取解析得到的各网络文件资源大小的流程示意图。参见图5,该流程包括:
步骤51,解析视频数据请求响应,获取视频数据请求响应的响应头;
步骤52,判断所述视频数据请求响应头中是否包含Content-Length字段,如果是,提取Content-Length字段后的信息,得到网络文件资源大小。
本步骤中,如果不包含Content-Length字段,则结束流程。在视频数据请求响应头中,可以包含一个或多个Content-Length字段,每一Content-Length字段对应一网络文件资源大小。
本发明实施例中,如果网页对应的链接为:
http://220.181.91.20/vkp.tc.qq.com/z0019wmqx48.m1.mp4?vkey=FA5630D37EA5E4A2B71B24554AF6E5FEAF75007C471610085FC27730C4D76FB6ABF418F131CEC013B5E064ED01BE177B98983AB86BA7FDA64340FF674DF7AE3348C6EC3B06BBF76E4FC59672C4E438B119BF736BF41A9891&br=34&platform=2&fmt=auto&level=30&sdtfrom=v3010
在向网页(网络服务器)发送视频数据请求(HTTP请求)时,标识仅返回HTTP响应头的信息,网页(网络服务器)在返回视频数据请求响应时,不用返回真正的mp4视频数据,只需返回视频数据请求响应头(HTTP请求响应头)即可。这样,由于仅包括视频数据请求响应头,而无需传输视频数据请求响应体,消耗的流量可以忽略不计。
对于mp4视频,返回的视频数据请求响应头中有一项为Content-Length,例如,如果包含"Content-Length:24103302"字段信息,其中,Content-Length字 段后的信息表示mp4视频大小,为24103302字节(B),即大约23MB。这样,通过提取各Content-Length字段后的信息,可以得到相应的网络文件资源大小,从而在播放视频之前获取到mp4视频的大小。
作为另一可选实施例,如果网络文件资源为M3U8视频,图6为本发明第五实施例解析依据所述视频数据请求返回的视频数据请求响应,获取解析得到的各网络文件资源大小的流程示意图。参见图6,该流程包括:
步骤61,解析视频数据请求响应,获取视频数据请求响应头中包含的M3U8文件;
本步骤中,M3U8是M3U的一种,编码格式为UTF-8,M3U用Latin-1字符集编码,M3U8文件是指采用UTF-8编码格式的M3U文件,为一文本的索引文件,一般大小为几KB,包含播放的视频链接的列表,每一播放的视频为一TS段,每一TS段包含时间长度描述信息:EXTINF,单位是秒。
步骤62,判断M3U8文件中预先设置的位置处是否包含M3U8视频大小信息,如果包含,得到网络文件资源大小;如果不包含,遍历M3U8文件,获取EXTINF字段后的时长信息;
本步骤中,如果M3U8文件中包含有各M3U8视频大小信息,则可以直接获取各网络文件资源大小。本发明实施例中,每一EXTINF字段对应一传输流(TS,Transport Stream)段,在M3U8文件中,可以包括一个或多个EXTINF字段。
步骤63,累加各时长信息,得到总时长;
本步骤中,遍历M3U8文件,统计所有TS段对应的时长信息,进行累加,得到总时长(SUM_TIME)。
步骤64,选取M3U8文件中预定数量的传输流段,发起HTTP请求,依据返回的HTTP请求响应获取所述预定数量的传输流段的样本总时长以及样本总大小;
本步骤中,选择M3U8文件中一个或多个(预定数量)传输流段发起HTTP 请求,处理与mp4文件相同,不播放,只获取该传输流段大小,对多个传输流段大小进行求和,得到样本总大小(SUB_SUM_SIZE),同时累加该多个传输流段的样本总时长(SUB_SUM_TIME)。
本发明实施例中,预定数量可依据实际需要设置,小于或等于M3U8文件中包含的TS段总数。
步骤65,依据所述样本总大小以及样本总时长计算样本传输速率,依据所述样本传输速率以及所述总时长得到网络文件资源大小。
本步骤中,利用下式计算网络文件资源大小:
Figure PCTCN2017075064-appb-000003
式中,
SUM_SIZE为网络文件资源大小;
SUM_TIME为总时长;
SUB_SUM_SIZE为样本总大小;
SUB_SUM_TIME为样本总时长。
本发明实施例中,依据所述样本传输速率以及EXTINF字段后的时长信息,可以得到各网络文件资源大小。
本发明实施例中,一M3U8文件示例如下:
EXTM3U
#EXT-X-TARGETDURATION:12
#EXT-X-VERSION:2
#EXTINF:5,
http://61.160.198.72/677389B272A4082913C1632ACF/0300080600565E5D897EBE2BEEFCF91A840284-1194-2D02-96D6-028EA1F28D65.mp4.ts?ts_start=0&ts_end=4.82&ts_seg_no=0&ts_keyframe=1
#EXTINF:5,
http://61.160.198.72/677389B272A4082913C1632ACF/0300080600565E5D897EBE2BEEFCF91A840284-1194-2D02-96D6-028EA1F28D65.mp4.ts?ts_start=4. 82&ts_end=9.74&ts_seg_no=1&ts_keyframe=1
…(省略了若干ts段)
#EXTINF:12,
http://221.228.249.78/6977AA57FD048841353D906496/0300080605565E5D897EBE2BEEFCF91A840284-1194-2D02-96D6-028EA1F28D65.mp4.ts?ts_start=274.46&ts_end=286.46&ts_seg_no=209&ts_keyframe=1
#EXTINF:10,
http://221.228.249.78/6977AA57FD048841353D906496/0300080605565E5D897EBE2BEEFCF91A840284-1194-2D02-96D6-028EA1F28D65.mp4.ts?ts_start=286.46&ts_end=296.22&ts_seg_no=210&ts_keyframe=1
#EXT-X-ENDLIST
步骤13,接收所述视频数据请求对应的网页输出的下载指令,所述下载指令为用户依据展示的剩余数据流量以及网络文件资源大小,选取待下载网络文件资源后生成的,下载所述待下载网络文件资源。
本步骤中,通过将剩余流量数据大小和当前待播放网络文件资源大小同时提供给用户,用户即可根据这两个数据的大小来做出选择播放还是取消播放。如果需要播放,则可以通过点击相应的网络文件资源,触发生成下载网络文件资源指令,下载所述待下载网络文件资源。例如,如果展示的用户所需的视频大小为20M,剩余数据流量为500M,用户可以选择播放该视频;如果剩余数据流量只有10M,则用户可以选择不观看该视频。
本发明实施例中,通过发送视频数据请求,触发获取剩余数据流量,展示获取的所述剩余数据流量;解析依据所述视频数据请求返回的视频数据请求响应,获取解析得到的各网络文件资源大小并展示;接收所述视频数据请求对应的网页输出的下载指令,所述下载指令为用户依据展示的剩余数据流量以及网络文件资源大小,选取待下载网络文件资源后生成的,下载所述待下载网络文件资源。这样,通过自动获取剩余数据流量以及网络文件资源大小并向用户展示,用户只需依据剩余数据流量以及网络文件资源大小选取所需的网络文件资 源进行下载,有效缩短了获取网络文件资源所需的时间,简化了操作流程,提升了获取网络文件资源的效率。
图7为本发明实施例获取网络文件资源的装置结构示意图。参见图7,该装置包括:剩余数据流量获取模块71、网络文件资源获取模块72以及网络文件资源下载模块73,其中,
剩余数据流量获取模块71,用于发送视频数据请求,触发获取剩余数据流量,展示获取的所述剩余数据流量;
本发明实施例中,作为一可选实施例,所述视频数据请求中携带有仅返回视频数据请求响应头的标识信息。
在所述发送视频数据请求之后,触发获取剩余数据流量之前,该方法还可以包括:
判断所述视频数据请求对应的网页中是否包含有超过预先设置的数据阈值的网络文件资源,如果有,执行所述触发获取剩余数据流量的步骤。
本发明实施例中,作为一可选实施例,可以通过在浏览器中注入预先设置的脚本,该脚本用于监测浏览器在发送视频数据请求的同时或之后,触发自动获取剩余数据流量。
本发明实施例中,作为一可选实施例,剩余数据流量获取模块71包括:请求发送单元、查询单元、提取单元、剩余数据流量获取单元以及展示单元(图中未示出),其中,
请求发送单元,用于在发送视频数据请求后,通知查询单元;
查询单元,用于查询存储的套餐文件,获取套餐数据流量阈值;
本发明实施例中,作为一可选实施例,套餐文件包括:套餐数据流量阈值以及套餐有效日期区间。其中,
套餐数据流量阈值包括但不限于:月套餐数据流量阈值、季度餐数据流量阈值、半年餐数据流量阈值、年餐数据流量阈值等。
提取单元,用于提取电子设备记录的系统日志信息,获取电子设备在套餐 有效日期区间内消耗的数据流量;
剩余数据流量获取单元,用于将所述套餐数据流量阈值减去所述电子设备在套餐有效日期区间内消耗的数据流量,得到剩余数据流量;
展示单元,用于展示获取的所述剩余数据流量。
本发明实施例中,作为一可选实施例,可以通过悬浮窗、通知栏等方式展示剩余数据流量。
本发明实施例中,作为另一可选实施例,剩余数据流量获取模块71包括:请求发送单元、查询单元、累计单元、更新单元、存储单元、剩余数据流量获取单元以及展示单元
请求发送单元,用于在发送视频数据请求后,通知查询单元;
查询单元,用于查询存储的套餐文件,获取套餐数据流量阈值;
累计单元,用于提取电子设备记录的系统日志信息,获取电子设备在套餐有效日期区间内,且在存储的所述时间信息之后的时间段内消耗的数据流量,累计所述存储的数据流量信息;
更新单元,用于以累计的数据流量信息及时间信息更新存储单元存储的数据流量信息以及时间信息;
存储单元,用于存储获取的数据流量信息以及时间信息,在所述套餐有效日期区间到后,清空存储的数据流量信息以及时间信息;
剩余数据流量获取单元,用于将所述套餐数据流量阈值减去所述电子设备在套餐有效日期区间内消耗的数据流量,得到剩余数据流量;
展示单元,用于展示获取的所述剩余数据流量。
本发明实施例中,作为再一可选实施例,剩余数据流量获取模块71包括:请求发送单元、调用单元以及剩余数据流量提取单元,其中,
请求发送单元,用于在发送视频数据请求后,通知调用单元;
调用单元,用于触发调用预先设置的流量查询短信,向预先设置的运营服务商发送;
本发明实施例中,通过预先设置流量查询短信,在接收到视频数据请求后,自动触发调用预编辑的流量查询短信,向运营服务商发送。
剩余数据流量提取单元,用于接收所述运营服务商反馈的短信,提取其中的剩余数据流量。
作为再一可选实施例,剩余数据流量获取模块71包括:请求发送单元、阈值查询单元、日志信息提取单元、第一剩余数据流量获取单元、短信查询单元、短信提取单元以及校正单元,其中,
请求发送单元,用于在发送视频数据请求后,通知阈值查询单元;
阈值查询单元,用于查询存储的套餐文件,获取套餐数据流量阈值;
日志信息提取单元,用于提取电子设备记录的系统日志信息,获取电子设备在套餐有效日期区间内消耗的数据流量;
第一剩余数据流量获取单元,用于将所述套餐数据流量阈值减去所述电子设备在套餐有效日期区间内消耗的数据流量,得到第一剩余数据流量;
短信查询单元,用于触发调用预先设置的流量查询短信,向预先设置的运营服务商发送;
短信提取单元,用于接收所述运营服务商反馈的短信,提取其中的第二剩余数据流量;
校正单元,用于利用所述第二剩余数据流量,按照预先设置的校正策略,对所述第一剩余数据流量进行校正,得到剩余数据流量。
网络文件资源获取模块72,用于解析依据所述视频数据请求返回的视频数据请求响应,获取解析得到的各网络文件资源大小并展示;
作为一可选实施例,网络文件资源包括:视频、音频、图片或动画等。其中,以视频为例,可以包括:mp4视频以及M3U8视频。
本发明实施例中,作为一可选实施例,所述网络文件资源为mp4视频,网络文件资源获取模块72包括:第一解析单元以及第一信息提取单元(图中未示出),其中,
第一解析单元,用于解析视频数据请求响应,获取视频数据请求响应响应头;
第一信息提取单元,用于判断所述视频数据请求响应头中是否包含Content-Length字段,如果是,提取Content-Length字段后的信息,得到网络文件资源大小。
本发明实施例中,如果不包含Content-Length字段,则结束流程。在视频数据请求响应头中,可以包含一个或多个Content-Length字段,每一Content-Length字段对应一网络文件资源大小。
本发明实施例中,作为另一可选实施例,所述网络文件资源为M3U8视频,网络文件资源获取模块72包括:第二解析单元、判断单元、累加单元、第二信息提取单元以及网络文件资源计算单元(图中未示出),其中,
第二解析单元,用于解析视频数据请求响应,获取视频数据请求响应头中包含的M3U8文件;
判断单元,用于判断M3U8文件中预先设置的位置处是否包含M3U8视频大小信息,如果包含,得到网络文件资源大小;如果不包含,遍历M3U8文件,获取EXTINF字段后的时长信息;
本发明实施例中,每一EXTINF字段对应一传输流(TS,Transport Stream)段,在M3U8文件中,可以包括一个或多个EXTINF字段。
累加单元,用于累加各时长信息,得到总时长;
第二信息提取单元,用于选取M3U8文件中预定数量的传输流段,发起HTTP请求,依据返回的HTTP请求响应获取所述预定数量的传输流段的样本总时长以及样本总大小;
网络文件资源计算单元,用于依据所述样本总大小以及样本总时长计算样本传输速率,依据所述样本传输速率以及所述总时长得到网络文件资源大小。
本发明实施例中,利用下式计算所述网络文件资源大小:
Figure PCTCN2017075064-appb-000004
式中,
SUM_SIZE为网络文件资源大小;
SUM_TIME为总时长;
SUB_SUM_SIZE为样本总大小;
SUB_SUM_TIME为样本总时长。
网络文件资源下载模块73,用于接收所述视频数据请求对应的网页输出的下载指令,所述下载指令为用户依据展示的剩余数据流量以及网络文件资源大小,选取待下载网络文件资源后生成的,下载所述待下载网络文件资源。
本发明实施例还提供一种电子设备,所述电子设备包含前述任一实施例所述的装置。
图8为本发明电子设备一个实施例的结构示意图,可以实现本发明图1-7所示实施例的流程,如图8所示,上述电子设备可以包括:壳体81、处理器82、存储器83、电路板84和电源电路85,其中,电路板84安置在壳体81围成的空间内部,处理器82和存储器83设置在电路板84上;电源电路85,用于为上述电子设备的各个电路或器件供电;存储器83用于存储可执行程序代码;处理器82通过读取存储器83中存储的可执行程序代码来运行与可执行程序代码对应的程序,用于执行前述任一实施例所述的获取网络文件资源的方法。
处理器82对上述步骤的具体执行过程以及处理器82通过运行可执行程序代码来进一步执行的步骤,可以参见本发明图1-7所示实施例的描述,在此不再赘述。
该电子设备以多种形式存在,包括但不限于:
(1)移动通信设备:这类设备的特点是具备移动通信功能,并且以提供话音、数据通信为主要目标。这类终端包括:智能手机(例如iPhone)、多媒体手机、功能性手机,以及低端手机等。
(2)超移动个人计算机设备:这类设备属于个人计算机的范畴,有计算和处理功能,一般也具备移动上网特性。这类终端包括:PDA、MID和UMPC 设备等,例如iPad。
(3)便携式娱乐设备:这类设备可以显示和播放多媒体内容。该类设备包括:音频、视频播放器(例如iPod),掌上游戏机,电子书,以及智能玩具和便携式车载导航设备。
(4)服务器:提供计算服务的设备,服务器的构成包括处理器、硬盘、内存、系统总线等,服务器和通用的计算机架构类似,但是由于需要提供高可靠的服务,因此在处理能力、稳定性、可靠性、安全性、可扩展性、可管理性等方面要求较高。
(5)其他具有数据交互功能的电子设备。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)或随机存储记忆体(Random Access Memory,RAM)等。
以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到的变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以权利要求的保护范围为准。

Claims (21)

  1. 一种获取网络文件资源的方法,其特征在于,包括:
    发送视频数据请求,触发获取剩余数据流量,展示获取的所述剩余数据流量;
    解析依据所述视频数据请求返回的视频数据请求响应,获取解析得到的各网络文件资源大小并展示;
    接收所述视频数据请求对应的网页输出的下载指令,所述下载指令为用户依据展示的剩余数据流量以及网络文件资源大小,选取待下载网络文件资源后生成的,下载所述待下载网络文件资源。
  2. 根据权利要求1所述的方法,其特征在于,所述视频数据请求中携带有仅返回视频数据请求响应头的标识信息。
  3. 根据权利要求1或2所述的方法,其特征在于,所述网络文件资源为mp4视频,所述解析依据所述视频数据请求返回的视频数据请求响应,获取解析得到的各网络文件资源大小包括:
    解析视频数据请求响应,获取视频数据请求响应响应头;
    判断所述视频数据请求响应头中是否包含Content-Length字段,如果是,提取Content-Length字段后的信息,得到网络文件资源大小。
  4. 根据权利要求1或2所述的方法,其特征在于,所述网络文件资源为M3U8视频,所述解析依据所述视频数据请求返回的视频数据请求响应,获取解析得到的各网络文件资源大小包括:
    解析视频数据请求响应,获取视频数据请求响应头中包含的M3U8文件;
    判断M3U8文件中预先设置的位置处是否包含M3U8视频大小信息,如果包含,得到网络文件资源大小;如果不包含,遍历M3U8文件,获取EXTINF字段后的时长信息;
    累加各时长信息,得到总时长;
    选取M3U8文件中预定数量的传输流段,发起HTTP请求,依据返回的 HTTP请求响应获取所述预定数量的传输流段的样本总时长以及样本总大小;
    依据所述样本总大小以及样本总时长计算样本传输速率,依据所述样本传输速率以及所述总时长得到网络文件资源大小。
  5. 根据权利要求4所述的方法,其特征在于,利用下式计算所述网络文件资源大小:
    Figure PCTCN2017075064-appb-100001
    式中,
    SUM_SIZE为网络文件资源大小;
    SUM_TIME为总时长;
    SUB_SUM_SIZE为样本总大小;
    SUB_SUM_TIME为样本总时长。
  6. 根据权利要求1至5任一项所述的方法,其特征在于,所述触发获取剩余数据流量包括:
    查询存储的套餐文件,获取套餐数据流量阈值;
    提取电子设备记录的系统日志信息,获取电子设备在套餐有效日期区间内消耗的数据流量;
    将所述套餐数据流量阈值减去所述电子设备在套餐有效日期区间内消耗的数据流量,得到剩余数据流量。
  7. 根据权利要求6所述的方法,其特征在于,所述方法还包括:
    存储获取的数据流量信息以及时间信息,在所述套餐有效日期区间到后,清空存储的数据流量信息以及时间信息;
    所述提取电子设备记录的系统日志信息,获取电子设备在套餐有效日期区间内消耗的数据流量包括:
    提取电子设备记录的系统日志信息,获取电子设备在套餐有效日期区间内,且在存储的所述时间信息之后的时间段内消耗的数据流量,累计所述存储的数 据流量信息;
    以累计的数据流量信息及时间信息更新存储的数据流量信息以及时间信息。
  8. 根据权利要求1至5任一项所述的方法,其特征在于,所述触发获取剩余数据流量包括:
    触发调用预先设置的流量查询短信,向预先设置的运营服务商发送;
    接收所述运营服务商反馈的短信,提取其中的剩余数据流量。
  9. 根据权利要求1至5任一项所述的方法,其特征在于,所述触发获取剩余数据流量包括:
    查询存储的套餐文件,获取套餐数据流量阈值;
    提取电子设备记录的系统日志信息,获取电子设备在套餐有效日期区间内消耗的数据流量;
    将所述套餐数据流量阈值减去所述电子设备在套餐有效日期区间内消耗的数据流量,得到第一剩余数据流量;
    触发调用预先设置的流量查询短信,向预先设置的运营服务商发送;
    接收所述运营服务商反馈的短信,提取其中的第二剩余数据流量;
    利用所述第二剩余数据流量,按照预先设置的校正策略,对所述第一剩余数据流量进行校正,得到剩余数据流量。
  10. 一种获取网络文件资源的装置,其特征在于,该装置包括:剩余数据流量获取模块、网络文件资源获取模块以及网络文件资源下载模块,其中,
    剩余数据流量获取模块,用于发送视频数据请求,触发获取剩余数据流量,展示获取的所述剩余数据流量;
    网络文件资源获取模块,用于解析依据所述视频数据请求返回的视频数据请求响应,获取解析得到的各网络文件资源大小并展示;
    网络文件资源下载模块,用于接收所述视频数据请求对应的网页输出的下载指令,所述下载指令为用户依据展示的剩余数据流量以及网络文件资源大小, 选取待下载网络文件资源后生成的,下载所述待下载网络文件资源。
  11. 根据权利要求10所述的装置,其特征在于,所述视频数据请求中携带有仅返回视频数据请求响应头的标识信息。
  12. 根据权利要求10或11所述的装置,其特征在于,所述网络文件资源为mp4视频,所述网络文件资源获取模块包括:第一解析单元以及第一信息提取单元,其中,
    第一解析单元,用于解析视频数据请求响应,获取视频数据请求响应响应头;
    第一信息提取单元,用于判断所述视频数据请求响应头中是否包含Content-Length字段,如果是,提取Content-Length字段后的信息,得到网络文件资源大小。
  13. 根据权利要求10或11所述的装置,其特征在于,所述网络文件资源为M3U8视频,所述网络文件资源获取模块包括:第二解析单元、判断单元、累加单元、第二信息提取单元以及网络文件资源计算单元,其中,
    第二解析单元,用于解析视频数据请求响应,获取视频数据请求响应头中包含的M3U8文件;
    判断单元,用于判断M3U8文件中预先设置的位置处是否包含M3U8视频大小信息,如果包含,得到网络文件资源大小;如果不包含,遍历M3U8文件,获取EXTINF字段后的时长信息;
    累加单元,用于累加各时长信息,得到总时长;
    第二信息提取单元,用于选取M3U8文件中预定数量的传输流段,发起HTTP请求,依据返回的HTTP请求响应获取所述预定数量的传输流段的样本总时长以及样本总大小;
    网络文件资源计算单元,用于依据所述样本总大小以及样本总时长计算样本传输速率,依据所述样本传输速率以及所述总时长得到网络文件资源大小。
  14. 根据权利要求13所述的装置,其特征在于,利用下式计算所述网络文 件资源大小:
    Figure PCTCN2017075064-appb-100002
    式中,
    SUM_SIZE为网络文件资源大小;
    SUM_TIME为总时长;
    SUB_SUM_SIZE为样本总大小;
    SUB_SUM_TIME为样本总时长。
  15. 根据权利要求10至14任一项所述的装置,其特征在于,所述剩余数据流量获取模块包括:请求发送单元、查询单元、提取单元、剩余数据流量获取单元以及展示单元,其中,
    请求发送单元,用于在发送视频数据请求后,通知查询单元;
    查询单元,用于查询存储的套餐文件,获取套餐数据流量阈值;
    提取单元,用于提取电子设备记录的系统日志信息,获取电子设备在套餐有效日期区间内消耗的数据流量;
    剩余数据流量获取单元,用于将所述套餐数据流量阈值减去所述电子设备在套餐有效日期区间内消耗的数据流量,得到剩余数据流量;
    展示单元,用于展示获取的所述剩余数据流量。
  16. 根据权利要求10至14任一项所述的装置,其特征在于,所述剩余数据流量获取模块包括:请求发送单元、查询单元、累计单元、更新单元、存储单元、剩余数据流量获取单元以及展示单元
    请求发送单元,用于在发送视频数据请求后,通知查询单元;
    查询单元,用于查询存储的套餐文件,获取套餐数据流量阈值;
    累计单元,用于提取电子设备记录的系统日志信息,获取电子设备在套餐有效日期区间内,且在存储的所述时间信息之后的时间段内消耗的数据流量,累计所述存储的数据流量信息;
    更新单元,用于以累计的数据流量信息及时间信息更新存储单元存储的数据流量信息以及时间信息;
    存储单元,用于存储获取的数据流量信息以及时间信息,在所述套餐有效日期区间到后,清空存储的数据流量信息以及时间信息;
    剩余数据流量获取单元,用于将所述套餐数据流量阈值减去所述电子设备在套餐有效日期区间内消耗的数据流量,得到剩余数据流量;
    展示单元,用于展示获取的所述剩余数据流量。
  17. 根据权利要求10至14任一项所述的装置,其特征在于,所述剩余数据流量获取模块包括:请求发送单元、调用单元以及剩余数据流量提取单元,其中,
    请求发送单元,用于在发送视频数据请求后,通知调用单元;
    调用单元,用于触发调用预先设置的流量查询短信,向预先设置的运营服务商发送;
    剩余数据流量提取单元,用于接收所述运营服务商反馈的短信,提取其中的剩余数据流量。
  18. 根据权利要求10至14任一项所述的装置,其特征在于,所述剩余数据流量获取模块包括:请求发送单元、阈值查询单元、日志信息提取单元、第一剩余数据流量获取单元、短信查询单元、短信提取单元以及校正单元,其中,
    请求发送单元,用于在发送视频数据请求后,通知阈值查询单元;
    阈值查询单元,用于查询存储的套餐文件,获取套餐数据流量阈值;
    日志信息提取单元,用于提取电子设备记录的系统日志信息,获取电子设备在套餐有效日期区间内消耗的数据流量;
    第一剩余数据流量获取单元,用于将所述套餐数据流量阈值减去所述电子设备在套餐有效日期区间内消耗的数据流量,得到第一剩余数据流量;
    短信查询单元,用于触发调用预先设置的流量查询短信,向预先设置的运营服务商发送;
    短信提取单元,用于接收所述运营服务商反馈的短信,提取其中的第二剩余数据流量;
    校正单元,用于利用所述第二剩余数据流量,按照预先设置的校正策略,对所述第一剩余数据流量进行校正,得到剩余数据流量。
  19. 一种电子设备,其特征在于,所述电子设备包括:壳体、处理器、存储器、电路板和电源电路,其中,电路板安置在壳体围成的空间内部,处理器和存储器设置在电路板上;电源电路,用于为上述电子设备的各个电路或器件供电;存储器用于存储可执行程序代码;处理器通过读取存储器中存储的可执行程序代码来运行与可执行程序代码对应的程序,用于执行前述任一权利要求1-9所述的获取网络文件资源的方法。
  20. 一种计算机程序产品,其特征在于,当所述计算机程序产品中的指令处理器执行时,执行一种获取网络文件资源的方法,所述方法包括:
    发送视频数据请求,触发获取剩余数据流量,展示获取的所述剩余数据流量;
    解析依据所述视频数据请求返回的视频数据请求响应,获取解析得到的各网络文件资源大小并展示;
    接收所述视频数据请求对应的网页输出的下载指令,所述下载指令为用户依据展示的剩余数据流量以及网络文件资源大小,选取待下载网络文件资源后生成的,下载所述待下载网络文件资源。
  21. 一种存储介质,其特征在于,当所述存储介质中的指令由移动终端的处理器被执行时,使得移动设备能够执行一种获取网络文件资源的方法,所述方法包括:
    发送视频数据请求,触发获取剩余数据流量,展示获取的所述剩余数据流量;
    解析依据所述视频数据请求返回的视频数据请求响应,获取解析得到的各网络文件资源大小并展示;
    接收所述视频数据请求对应的网页输出的下载指令,所述下载指令为用户依据展示的剩余数据流量以及网络文件资源大小,选取待下载网络文件资源后生成的,下载所述待下载网络文件资源。
PCT/CN2017/075064 2016-03-07 2017-02-27 一种获取网络文件资源的方法、装置及电子设备 WO2017152792A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610126328.7 2016-03-07
CN201610126328.7A CN105808714B (zh) 2016-03-07 2016-03-07 一种获取网络文件资源的方法、装置及电子设备

Publications (1)

Publication Number Publication Date
WO2017152792A1 true WO2017152792A1 (zh) 2017-09-14

Family

ID=56467754

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/075064 WO2017152792A1 (zh) 2016-03-07 2017-02-27 一种获取网络文件资源的方法、装置及电子设备

Country Status (2)

Country Link
CN (1) CN105808714B (zh)
WO (1) WO2017152792A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111818219A (zh) * 2019-04-11 2020-10-23 阿尔派株式会社 电子设备及电子设备的提示信息控制方法

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105808714B (zh) * 2016-03-07 2019-05-17 北京金山安全软件有限公司 一种获取网络文件资源的方法、装置及电子设备
CN109151579B (zh) * 2018-09-07 2021-02-26 杭州迪普科技股份有限公司 一种测试web视频流量是否正确识别的方法、装置及设备
CN109995863B (zh) * 2019-03-29 2022-04-22 北京金山安全软件有限公司 一种动态资源下载方法、装置、电子设备及存储介质
CN110379236A (zh) * 2019-05-29 2019-10-25 昆明纯全教育信息咨询有限公司 微视频教学方法中的视频播放方法、装置、计算机可读存储介质及服务器
CN114640890B (zh) * 2020-12-15 2024-05-17 北京神州数码云科信息技术有限公司 一种视频数据动态加载方法、装置、电子设备及存储介质

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103260142A (zh) * 2013-06-03 2013-08-21 亚信联创科技(中国)有限公司 手机终端对应用户的网络资源匹配检测方法及系统
EP2768204A1 (en) * 2013-02-15 2014-08-20 Telefonaktiebolaget L M Ericsson (publ) Method and multimedia content manager for managing multimedia content download
CN104009892A (zh) * 2014-06-12 2014-08-27 北京奇虎科技有限公司 一种移动终端流量的监控方法、装置及客户端
CN104581671A (zh) * 2015-01-21 2015-04-29 深圳市中兴移动通信有限公司 数据流量提示方法和装置
CN104767809A (zh) * 2015-04-02 2015-07-08 天脉聚源(北京)教育科技有限公司 一种下载控制方法及系统
CN105808714A (zh) * 2016-03-07 2016-07-27 北京金山安全软件有限公司 一种获取网络文件资源的方法、装置及电子设备

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103188647A (zh) * 2011-12-29 2013-07-03 北京网秦天下科技有限公司 一种移动终端上网流量统计分析和提醒的方法和系统
CN103391504B (zh) * 2013-07-24 2016-08-10 中国联合网络通信集团有限公司 一种流量提醒的方法及装置
CN103546829A (zh) * 2013-10-23 2014-01-29 华为技术有限公司 一种视频业务处理方法及设备
CN103648019A (zh) * 2013-11-29 2014-03-19 乐视致新电子科技(天津)有限公司 一种基于hls协议的视频下载方法及其装置
CN105142184A (zh) * 2015-06-12 2015-12-09 联想(北京)有限公司 一种流量控制方法及电子设备

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2768204A1 (en) * 2013-02-15 2014-08-20 Telefonaktiebolaget L M Ericsson (publ) Method and multimedia content manager for managing multimedia content download
CN103260142A (zh) * 2013-06-03 2013-08-21 亚信联创科技(中国)有限公司 手机终端对应用户的网络资源匹配检测方法及系统
CN104009892A (zh) * 2014-06-12 2014-08-27 北京奇虎科技有限公司 一种移动终端流量的监控方法、装置及客户端
CN104581671A (zh) * 2015-01-21 2015-04-29 深圳市中兴移动通信有限公司 数据流量提示方法和装置
CN104767809A (zh) * 2015-04-02 2015-07-08 天脉聚源(北京)教育科技有限公司 一种下载控制方法及系统
CN105808714A (zh) * 2016-03-07 2016-07-27 北京金山安全软件有限公司 一种获取网络文件资源的方法、装置及电子设备

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111818219A (zh) * 2019-04-11 2020-10-23 阿尔派株式会社 电子设备及电子设备的提示信息控制方法
CN111818219B (zh) * 2019-04-11 2023-03-14 阿尔派株式会社 电子设备及电子设备的提示信息控制方法

Also Published As

Publication number Publication date
CN105808714B (zh) 2019-05-17
CN105808714A (zh) 2016-07-27

Similar Documents

Publication Publication Date Title
WO2017152792A1 (zh) 一种获取网络文件资源的方法、装置及电子设备
CN105577777B (zh) 一种消息处理方法、装置及系统
KR102221066B1 (ko) 미디어 프리젠테이션 디스크립션
US8943164B2 (en) Apparatus and methods for retrieving/ downloading content on a communication device
CN106303654B (zh) 一种媒体信息的展示方法、客户端、插件及系统
CN102929938B (zh) 一种可播放型网络资源的排序方法及装置
CN102831537B (zh) 一种获取网络广告信息的方法及装置
CN109152094B (zh) 用于终端的无线网络连接方法
US11949963B2 (en) Methods and systems for transmitting highlights of sporting events to communication devices
WO2020094036A1 (zh) 用于终端的无线网络连接方法
WO2017140165A1 (zh) 一种存储资源的方法、装置及电子设备
US20170195206A1 (en) Method and electronic device for controlling networking state of terminal
CN104317804A (zh) 发布投票信息的方法和装置
CN110602564A (zh) 视频优化信息提供方法、装置、电子设备及可读介质
TW201546736A (zh) 用以促進向行動裝置使用者銷售產品及服務之系統及方法
WO2016090889A1 (zh) 推广信息的处理方法、装置、设备及非易失性计算机存储介质
US10700879B2 (en) Charging method and device, access device, service quality control method and device
US9635069B2 (en) User feedback systems and methods
US10728248B2 (en) Validating toll-free access to streaming media content using a signature
WO2012131708A2 (en) Video messaging and mailing service
CN114025184A (zh) 一种视频直播方法及电子设备
US20090265480A1 (en) Method for determining complementary data regarding at least one piece of content, method for transmitting said complementary data, associated processing device and application server
CN112423099A (zh) 视频加载方法、装置和电子设备
JP2008033628A (ja) 広告システム、端末装置、サーバ、広告情報処理方法
RU46896U1 (ru) Устройство электронной платежной системы (варианты)

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17762478

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205 DATED 18/12/2018)

122 Ep: pct application non-entry in european phase

Ref document number: 17762478

Country of ref document: EP

Kind code of ref document: A1