EPG page restoration method, device and equipment

By building an Ajax mapping table and preloading high-priority requests before loading the EPG page, the problem of low efficiency of EPG page restoration is solved, and faster response content acquisition and page restoration is achieved.

CN117235394BActive Publication Date: 2025-08-12FIBERHOME TELECOMMUNICATION TECHNOLOGIES CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311254700.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-26
Publication Date
2025-08-12
Estimated Expiration
2043-09-26

AI Technical Summary

Technical Problem

In the prior art, EPG page restoration efficiency is low, especially when the browser kernel is unable to compatible with EPG writing methods, resulting in display exceptions or business logic execution exceptions.

Method used

By building an Ajax mapping table, preload high-priority Ajax requests before loading the EPG page, and prioritize the response content from the cache during the loading process, avoiding direct requests from the web server.

Benefits of technology

Improves the restoration efficiency of EPG pages, shortens the time to obtain response content, and ensures that other requests relying on high-priority Ajax requests can be executed smoothly.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117235394B_ABST
    Figure CN117235394B_ABST
Patent Text Reader

Abstract

The present invention provides an EPG page restoration method, device, and equipment. The method comprises: before loading the EPG page, preloading the high-priority Ajax request corresponding to the high-priority record in the Ajax mapping table; during the EPG page loading process, preferentially obtaining the corresponding response content from the cache for each Ajax request. Through the present invention, before loading the EPG page, the high-priority Ajax request corresponding to the high-priority record in the Ajax mapping table is preloaded, so that other Ajax requests that subsequently rely on the high-priority Ajax request can be executed smoothly. During the EPG page loading process, preferentially obtaining the corresponding response content from the cache for each Ajax request, rather than directly sending all Ajax requests to the Web server to obtain the corresponding response content, thereby reducing the time for obtaining the response content and improving the efficiency of EPG page restoration.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of web technology, and in particular to an EPG page restoration method, device and equipment. Background Art

[0002] On smart set-top boxes (STBs), the browser, as fundamental software, displays content to users by loading an Electronic Program Guide (EPG). When EPG logic is anomalies or the browser kernel is incompatible with the EPG's syntax, browser display anomalies or business logic execution errors can occur. STB browser developers need to extract EPG page resources from network packets, build a test page on a local server, and then debug the EPG execution logic to restore the problematic scenario.

[0003] Ajax technology is commonly used in EPG pages. Ajax is a technology used to create fast, dynamic web pages. By using Ajax, requests can be sent to the web server asynchronously and data can be retrieved without refreshing the entire page, thereby improving the response speed of the web page and the user experience. At the same time, when configuring the test page locally, it is often the case that the test page logic execution is abnormal due to abnormal Ajax responses issued in the page. However, the execution status of asynchronous loading requests such as Ajax is completely dependent on the EPG platform. Typically, the response content of each Ajax request needs to be configured separately, and the set-top box end always needs to send a request to the web server, resulting in the inability to quickly restore the EPG page when the problem occurs on the set-top box terminal. Summary of the Invention

[0004] The main purpose of the present invention is to provide an EPG page restoration method, device and equipment, aiming to solve the technical problem of low efficiency in restoring EPG pages in the prior art.

[0005] In a first aspect, the present invention provides an EPG page restoration method, the EPG page restoration method comprising:

[0006] Loading an Ajax mapping table, wherein the Ajax mapping table is constructed based on the parsing result of the electronic program guide (EPG) data packet, wherein each record in the Ajax mapping table includes a request address field, a cache flag field, and a response content field corresponding to an Ajax request;

[0007] Before loading the EPG page, preload the high-priority Ajax requests corresponding to the high-priority records in the Ajax mapping table;

[0008] During the loading of the EPG page, for each Ajax request, a target record with the same request address field is determined in the Ajax mapping table;

[0009] If the response content field of the target record is valid, then obtain the response content field of the target record from the Ajax mapping table;

[0010] If the response content field of the target record is invalid and the cache flag field is the first character, then check whether the target response content corresponding to the target record exists in the cache;

[0011] If the target response content corresponding to the target record exists in the cache, the target response content is obtained from the cache.

[0012] Optionally, each record in the Ajax mapping table further includes a request priority field, and the step of preloading high-priority Ajax requests corresponding to high-priority records in the Ajax mapping table includes:

[0013] Traverse each record in the Ajax mapping table, and if the request priority field of the record is a preset character, it is determined to be a high priority record;

[0014] For each high-priority record, if the response content field of the high-priority record is valid, obtain the response content field of the high-priority record from the Ajax mapping table;

[0015] If the response content field of the high-priority record is invalid and the cache flag field is the first character, then check whether the response content corresponding to the high-priority record exists in the cache;

[0016] If the response content corresponding to the high-priority record exists in the cache, the response content corresponding to the high-priority record is obtained from the cache.

[0017] Optionally, after the step of determining the record as a high priority record, the method further includes:

[0018] If the response content field of the high-priority record is invalid and the cache flag field is the second character, then send a high-priority Ajax request corresponding to the high-priority record to the web server, and receive the response content fed back by the web server based on the high-priority Ajax request;

[0019] After the step of detecting whether there is response content corresponding to the high-priority record in the cache, the method further includes:

[0020] If the response content corresponding to the high-priority record does not exist in the cache, a high-priority Ajax request corresponding to the high-priority record is sent to the Web server;

[0021] Receive the response content fed back by the Web server based on the high-priority Ajax request, and store it in the cache.

[0022] Optionally, after the step of determining, in the Ajax mapping table, for each Ajax request, a target record having the same request address field as the Ajax request, the following step is further included:

[0023] If the response content field of the target record is invalid and the cache flag field is the second character, then send the target Ajax request corresponding to the target record to the web server, and receive the response content fed back by the web server based on the target Ajax request;

[0024] After the step of detecting whether the target response content corresponding to the target record exists in the cache, the method further includes:

[0025] If the target response content corresponding to the target record does not exist in the cache, the target Ajax request corresponding to the target record is sent to the Web server;

[0026] Receive the response content fed back by the Web server based on the target Ajax request and store it in the cache.

[0027] Optionally, before loading the Ajax mapping table, the method further includes:

[0028] Parse EPG data packets frame by frame and filter out HTTP messages;

[0029] For each HTTP message, if the HTTP message is a request message, the destination IP address of the request message is used as the root directory, and resource file directories with the same name as the request address of the request message are created step by step; if the request message is an Ajax request, a new record is added to the Ajax mapping table, and the request address corresponding to the Ajax request is written into the request address field of the new record, and the first character is written into the cache flag field of the new record;

[0030] If the HTTP message is a response message, the response message is parsed to obtain the response content, response code, and response type, and the response content is written to the resource file directory with the same name as the request address of the HTTP request corresponding to the response message; if the response message is a response message corresponding to an Ajax request, the response code and response type are written into the response code field and response type field of the specific record in the Ajax mapping table respectively, and the specific record is the record corresponding to the Ajax request corresponding to the response message;

[0031] After all HTTP messages are traversed, the Ajax mapping table is transmitted to the Web server and / or set-top box, and the folder corresponding to the resource file directory is transmitted to the Web server.

[0032] Optionally, after the step of transmitting the Ajax mapping table to the Web server and / or the set-top box, the method further includes:

[0033] Receive an operation instruction, and perform a modification operation on the Ajax mapping table on the Web server and / or set-top box side based on the operation instruction, wherein the modification operation includes a new record operation, a record deletion operation, and a field modification operation.

[0034] Optionally, after the step of modifying the Ajax mapping table on the Web server and / or set-top box side based on the operation instruction, the method further includes:

[0035] Load the modified Ajax mapping table;

[0036] For each record in the modified Ajax mapping table, the content that does not exist in the Ajax mapping table is deleted from the cache.

[0037] Optionally, each record in the Ajax mapping table further includes a state change event field corresponding to an Ajax request, and after the step of loading the modified Ajax mapping table, the following step is further included:

[0038] For each record in the modified Ajax mapping table, when it is detected that the field content of the state change event field is not the default value, the JavaScript engine is used to parse it, and the OnReadyStateChange callback method of the XMLHttpRequest object corresponding to the corresponding Ajax request is replaced with the parsed result.

[0039] In a second aspect, the present invention further provides an EPG page restoration device, the EPG page restoration device comprising:

[0040] A table loading module is used to load an Ajax mapping table, wherein the Ajax mapping table is constructed based on the parsing result of the electronic program guide (EPG) data packet, and each record in the Ajax mapping table includes a request address field, a cache flag field, and a response content field corresponding to an Ajax request;

[0041] The preloading module is used to preload the high-priority Ajax requests corresponding to the high-priority records in the Ajax mapping table before loading the EPG page;

[0042] The page loading module is used to determine the target record with the same request address field in the Ajax mapping table for each Ajax request during the loading of the EPG page;

[0043] If the response content field of the target record is valid, then obtain the response content field of the target record from the Ajax mapping table;

[0044] If the response content field of the target record is invalid and the cache flag field is the first character, then check whether the target response content corresponding to the target record exists in the cache;

[0045] If the target response content corresponding to the target record exists in the cache, the target response content is obtained from the cache.

[0046] In a third aspect, the present invention also provides an EPG page restoration device, which includes a processor, a memory, and an EPG page restoration program stored in the memory and executable by the processor, wherein when the EPG page restoration program is executed by the processor, the steps of the EPG page restoration method described above are implemented.

[0047] In the present invention, an Ajax mapping table is loaded, and the Ajax mapping table is constructed based on the parsing result of the electronic program guide (EPG) data packet. Each record in the Ajax mapping table includes a request address field, a cache flag field, and a response content field corresponding to an Ajax request; before loading the EPG page, a high-priority Ajax request corresponding to a high-priority record in the Ajax mapping table is preloaded; during the loading of the EPG page, for each Ajax request, a target record with the same request address field as the target record is determined in the Ajax mapping table; if the response content field of the target record is valid, the response content field of the target record is obtained from the Ajax mapping table; if the response content field of the target record is invalid and the cache flag field is the first character, it is detected whether the target response content corresponding to the target record exists in the cache; if the target response content corresponding to the target record exists in the cache, the target response content is obtained from the cache. By using the present invention, before loading the EPG page, the high-priority Ajax requests corresponding to the high-priority records in the Ajax mapping table are preloaded, so that other Ajax requests that subsequently depend on the high-priority Ajax requests can be executed smoothly. In the process of loading the EPG page, the corresponding response content is obtained from the cache first for each Ajax request, rather than directly sending all Ajax requests to the Web server to obtain the corresponding response content, thereby reducing the time for obtaining the response content and improving the efficiency of restoring the EPG page. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] Figure 1 A schematic flow chart of an embodiment of an EPG page restoration method according to the present invention;

[0049] Figure 2 This is a structural diagram of records in the Ajax mapping table in an embodiment of the EPG page restoration method of the present invention;

[0050] Figure 3 A schematic diagram comparing the embodiment of the present application with the traditional Ajax request method;

[0051] Figure 4A schematic diagram of the functional modules of an embodiment of an EPG page restoration device according to the present invention;

[0052] Figure 5 The figure is a schematic diagram of the hardware structure of the EPG page restoration device involved in the embodiment of the present invention.

[0053] The purpose, features and advantages of the present invention will be further described with reference to the accompanying drawings and in conjunction with the embodiments. DETAILED DESCRIPTION

[0054] It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0055] In a first aspect, an embodiment of the present invention provides an EPG page restoration method.

[0056] In one embodiment, referring to Figure 1 , Figure 1 FIG. 1 is a flow chart of an embodiment of an EPG page restoration method of the present invention. Figure 1 As shown, the EPG page restoration method includes:

[0057] Step S10, loading an Ajax mapping table, wherein the Ajax mapping table is constructed based on the parsing result of the electronic program guide (EPG) data packet, and each record in the Ajax mapping table includes a request address field, a cache flag field, and a response content field corresponding to an Ajax request;

[0058] In this embodiment, after the set-top box is powered on, the system launches the built-in browser process. The browser kernel reads the system property value pre-configured on the set-top box side and determines whether debug mode is enabled based on the system property value. For example, if the system property value is 00, debug mode is enabled; if the system property value is 01, debug mode is disabled. If debug mode is disabled, the Ajax request is processed in a conventional manner. If debug mode is enabled, the browser kernel executes step S10.

[0059] Wherein, if the Ajax mapping table is stored in the set-top box end, then load the Ajax mapping table from this end based on the loading path of the Ajax mapping table.If the set-top box end does not store the Ajax mapping table, and the Ajax mapping table is stored in the Web server, then request the Web server for loading the Ajax mapping table.

[0060] The Ajax mapping table is constructed based on the parsing results of the electronic program guide (EPG) data packet. Each record in the Ajax mapping table includes a request address field, a cache flag field, and a response content field corresponding to an Ajax request. Figure 2 , Figure 2 This is a schematic diagram of the structure of the records in the Ajax mapping table in the first embodiment of the EPG page restoration method of the present invention. Figure 2 As shown, the record includes a request address field, a response code field, a cache flag field, a request priority field, a response type field, a response content field, and a state change event field.

[0061] Request address field (URL): contains the complete Ajax request path. This field is the only credential to distinguish different Ajax requests.

[0062] Response Code field: represents the response status code corresponding to the Ajax request. Debuggers can modify this field to special response codes such as HTTP404 and HTTP500 so that the browser kernel can directly enter the corresponding response state and execute the corresponding Ajax response state logic of the EPG without waiting when executing the request. The default response code is HTTP200.

[0063] Cache Flag field (Cache Flag): 0 means forcing a request to the Web server, 1 means caching the response content corresponding to this Ajax request. The browser on the set-top box can refresh or cache the response content corresponding to a specific Ajax request based on this field. The default value is 1.

[0064] Request priority field (Priority): If the field value is high, it indicates that the corresponding Ajax request is a high-priority Ajax request.

[0065] Response Type field (Response Type): Indicates the expected Ajax response type, such as XML (Extensible Markup Language), JavaScript (a lightweight, interpreted or just-in-time compiled programming language with function priority), JSON (JavaScript Object Notation, a lightweight data exchange format), etc. The default is JSON.

[0066] Response content field (Content): After the browser on the set-top box detects that there is content in this field, it directly reads the content of this field as the response to the corresponding Ajax request, updates the cache, and no longer issues a request to the Web server; the default is empty. When it is empty, it is necessary to read the cache or request the Web server.

[0067] State Change Event Field (OnReadyStateChange): After the set-top box detects the contents of this field, it uses the JavaScript engine to parse and replace the OnReadyStateChange callback method of the XMLHttpRequest object corresponding to the Ajax request. This allows debuggers to debug the state change logic of the Ajax request without modifying the original EPG page. The default value is empty, which means that the original OnReadyStateChange callback event logic of the EPG page is used.

[0068] It should be noted that the fields included in each record in the Ajax mapping table here can be expanded or reduced according to actual needs.

[0069] Furthermore, in one embodiment, before step S10, the method further includes:

[0070] Step S01, parsing the EPG data packets frame by frame to filter out HTTP messages;

[0071] In this embodiment, considering that the hardware conditions of the set-top box are limited and its data processing capability is average, steps S01 to S04 can be executed by the PC.

[0072] Specifically, the PC-side packet parser loads EPG packets obtained from the EPG platform's live network environment using a packet capture tool such as Wireshark. The packet parser parses the EPG packets frame by frame based on network access interfaces such as WinPcap and Npcap, filtering out HTTP messages.

[0073] Step S02: For each HTTP message, if the HTTP message is a request message, a resource file directory with the same name as the request address of the request message is created step by step, with the destination IP address of the request message as the root directory; if the request message is an Ajax request, a new record is added to the Ajax mapping table, and the request address corresponding to the Ajax request is written into the request address field of the new record, and the first character is written into the cache flag field of the new record;

[0074] In this embodiment, for each HTTP message, whether it is a request message or a response message is distinguished according to the message header information.

[0075] In an HTTP request message, the first line usually contains the request method, such as GET, POST, or PUT, followed by the request address. If the message header contains one of these methods, it can be determined to be a request message.

[0076] In an HTTP response message, the first line usually contains the HTTP version number starting with "HTTP / " and the response status code, such as 200, 404, 500, etc. Based on this feature, it can be determined that it is a response message.

[0077] If the HTTP message is a request message, the source / destination IP address, source / destination port number, and request address of the HTTP request message are extracted, and a custom network data frame object is created within the program. The network data frame object is an instance of a custom class within the packet parser, encapsulating information such as the source / destination IP address, source / destination port number, and request address. Subsequent resource file directory creation and response content writing are based on this object. With the request message's destination IP address as the root directory, resource file directories with the same name as the request message's request address are created layer by layer.

[0078] Furthermore, the "X-Requested-With" field in the HTTP request message header is extracted. If the value is "XMLHttpRequest," the HTTP request message is determined to be an Ajax request. A new record is then added to the Ajax mapping table, with the request address field of the new record written with the request address of the Ajax request. The cache flag field of the new record is written with 1 (i.e., the first character), indicating that the response content corresponding to this request is cached by default. Using the destination IP address of the Ajax request as the root directory, resource file directories with the same name as the corresponding request address are created level by level, and the file names are saved.

[0079] X-Requested-With is an HTTP request field that indicates the request was initiated by Ajax. When the value of this field is "XMLHttpRequest," it indicates that the request was initiated by the XMLHttpRequest object. In browsers, XMLHttpRequest is a JavaScript interface used to send HTTP requests between browsers and servers. Ajax requests rely on the XMLHttpRequest object provided by browsers.

[0080] Step S03: If the HTTP message is a response message, the response message is parsed to obtain the response content, response code, and response type, and the response content is written into a resource file directory with the same name as the request address of the HTTP request corresponding to the response message; if the response message is a response message corresponding to an Ajax request, the response code and response type are written into the response code field and response type field of a specific record in the Ajax mapping table, respectively, where the specific record is the record corresponding to the Ajax request corresponding to the response message;

[0081] In this embodiment, parsing the response message is an existing technology well known to professional and technical personnel in this field and will not be described in detail here.

[0082] Step S04: After all HTTP messages are traversed, the Ajax mapping table is transmitted to the Web server and / or the set-top box, and the folder corresponding to the resource file directory is transmitted to the Web server.

[0083] In this embodiment, the Ajax mapping table is transmitted to the Web server and / or the set-top box. Since the folder corresponding to the resource file directory has a large amount of data and is not suitable for storage on the set-top box, the folder corresponding to the resource file directory is transmitted to the Web server. Alternatively, the PC is used as the Web server corresponding to the set-top box.

[0084] When transferring the folder corresponding to the resource file directory to the web server, not only the resource file itself is uploaded, but the entire folder created and named after the destination IP address must also be uploaded. For example, an Ajax request with the URL http: / / 36.155.98.95 / play / auth will start uploading the folder named after the destination IP address (here, 36.155.98.95), rather than uploading the "auth" resource file itself.

[0085] Currently, mainstream network packet analysis tools such as WireShark and Fiddler are unable to classify resource types and directly store them by HTTP request path when extracting page resources. Browser developers need to manually configure the resource path and upload it to the web server. Through this embodiment, the request address and Ajax request are identified based on the HTTP request header, storage directories are created step by step according to the request address, and Ajax mapping table files are generated. The corresponding response content is written to the storage directory. Based on a transmission protocol such as FTP and TFTP, the unpacked content and Ajax mapping table are uploaded to a local or web server. This can automatically classify and parse network packets and package them according to a specific path and upload them to a local web server.

[0086] Step S20: Before loading the EPG page, preload the high-priority Ajax request corresponding to the high-priority record in the Ajax mapping table;

[0087] In this embodiment, in order to ensure that subsequent Ajax requests can be executed smoothly, it is necessary to preload the high-priority Ajax requests corresponding to the high-priority records in the Ajax mapping table before loading the EPG page.

[0088] Furthermore, in one embodiment, each record in the Ajax mapping table further includes a request priority field, and step S20 includes:

[0089] Step S201, traverse each record in the Ajax mapping table, wherein if the request priority field of the record is a preset character, it is determined to be a high priority record;

[0090] In this embodiment, it is sequentially detected whether the request priority field of each record in the Ajax mapping table is a preset character, such as "high". If so, the record is determined to be a high priority record.

[0091] Step S202: for each high-priority record, if the response content field of the high-priority record is valid, obtain the response content field of the high-priority record from the Ajax mapping table;

[0092] In this embodiment, if the response content field of the high priority record is valid, the response content field of the high priority record is directly obtained from the Ajax mapping table. The response content field is empty by default, which indicates that the response content field is invalid. If it is not empty, it indicates that the response content field is valid.

[0093] Step S203: If the response content field of the high-priority record is invalid and the cache flag field is the first character, then check whether there is a response content corresponding to the high-priority record in the cache;

[0094] Step S204: If the response content corresponding to the high-priority record exists in the cache, the response content corresponding to the high-priority record is obtained from the cache.

[0095] In this embodiment, if the response content field of the high-priority record is invalid (indicating that the response content of the high-priority record cannot be obtained from the response content field of the high-priority record) and the cache flag field is the first character (indicating that the response content corresponding to this request is cached by default), the response content corresponding to the high-priority record is searched from the cache; if it can be found, the response content corresponding to the high-priority record is obtained from the cache.

[0096] Furthermore, in one embodiment, after step S201, the method further includes:

[0097] If the response content field of the high-priority record is invalid and the cache flag field is the second character, then send a high-priority Ajax request corresponding to the high-priority record to the web server, and receive the response content fed back by the web server based on the high-priority Ajax request;

[0098] In this embodiment, if the response content field of the high-priority record is invalid and the cache flag field is the second character, it means that the response content of the high-priority record cannot be obtained from the response content field of the high-priority record and the response content of the high-priority record is not cached. In other words, the response content of the high-priority record does not exist in the cache. Therefore, a high-priority Ajax request corresponding to the high-priority record is sent to the web server, and the response content fed back by the web server based on the high-priority Ajax request is received.

[0099] After step S203, the method further includes:

[0100] If the response content corresponding to the high-priority record does not exist in the cache, a high-priority Ajax request corresponding to the high-priority record is sent to the Web server; the response content fed back by the Web server based on the high-priority Ajax request is received and stored in the cache.

[0101] In this embodiment, if the response content corresponding to the high-priority record does not exist in the cache, a high-priority Ajax request corresponding to the high-priority record is sent to the web server; and the response content returned by the web server based on the high-priority Ajax request is received. Because the cache flag field is the first character, the received response content returned by the web server based on the high-priority Ajax request is stored in the cache.

[0102] Step S30, during the process of loading the EPG page, for each Ajax request, determining a target record having the same request address field in the Ajax mapping table;

[0103] In this embodiment, during the EPG page loading process, JavaScript statements within the EPG page trigger HTTP requests, such as using "window.location.href" to redirect to the page. This triggers an Ajax request via the open method of the XMLHttpRequest object, with the request type controlled by the JavaScript logic within the test page. Ajax, or Asynchronous JavaScript and XML, allows for dynamic updates of portions of a page without refreshing the entire page. During the EPG page loading process, HTTP requests other than Ajax requests are handled conventionally and are not detailed here.

[0104] For each Ajax request, a target record with the same request address field is determined in the Ajax mapping table, that is, the content in the request address field of the target record is the same as the request address corresponding to the Ajax request.

[0105] Step S40: If the response content field of the target record is valid, the response content field of the target record is obtained from the Ajax mapping table;

[0106] Step S50: If the response content field of the target record is invalid and the cache flag field is the first character, then check whether there is a target response content corresponding to the target record in the cache;

[0107] Step S60: If the target response content corresponding to the target record exists in the cache, the target response content is obtained from the cache.

[0108] In this embodiment, the specific embodiments of steps S40 to S60 may refer to the embodiments of steps S202 to S204 and are not described in detail here.

[0109] In this embodiment, an Ajax mapping table is loaded, and the Ajax mapping table is constructed based on the parsing results of the electronic program guide (EPG) data packet. Each record in the Ajax mapping table includes a request address field, a cache flag field, and a response content field corresponding to an Ajax request. Before loading the EPG page, high-priority Ajax requests corresponding to high-priority records in the Ajax mapping table are preloaded. During the process of loading the EPG page, for each Ajax request, a target record with the same request address field as its request is determined in the Ajax mapping table. If the response content field of the target record is valid, the response content field of the target record is obtained from the Ajax mapping table. If the response content field of the target record is invalid and the cache flag field is the first character, it is detected whether the target response content corresponding to the target record exists in the cache. If the target response content corresponding to the target record exists in the cache, the target response content is obtained from the cache. Through this embodiment, before loading the EPG page, the high-priority Ajax requests corresponding to the high-priority records in the Ajax mapping table are preloaded, so that other subsequent Ajax requests that depend on the high-priority Ajax requests can be executed smoothly. In the process of loading the EPG page, the corresponding response content is obtained from the cache for each Ajax request first, instead of directly sending all Ajax requests to the Web server to obtain the corresponding response content, thereby reducing the time for obtaining the response content and improving the efficiency of EPG page restoration.

[0110] Furthermore, in one embodiment, after step S30, the method further includes:

[0111] If the response content field of the target record is invalid and the cache flag field is the second character, then send the target Ajax request corresponding to the target record to the web server, and receive the response content fed back by the web server based on the target Ajax request;

[0112] After step S50, the method further includes:

[0113] If the target response content corresponding to the target record does not exist in the cache, the target Ajax request corresponding to the target record is sent to the Web server; the response content fed back by the Web server based on the target Ajax request is received and stored in the cache.

[0114] In this embodiment, reference may be made to the above-mentioned embodiments after step S201 and the embodiments after step S203, which are not described in detail here.

[0115] Furthermore, in one embodiment, after step S04, the method further includes:

[0116] Receive an operation instruction, and perform a modification operation on the Ajax mapping table on the Web server and / or set-top box side based on the operation instruction, wherein the modification operation includes a new record operation, a record deletion operation, and a field modification operation.

[0117] In this embodiment, the user can send an operation instruction to the web server or set-top box side according to actual needs, thereby modifying the Ajax mapping table on the web server or set-top box side. The modification operation includes adding a new record, deleting a record, and modifying a field. It should be noted that this is only a schematic description of the modification operation, and the types of operation included in the modification operation can be reduced or expanded according to actual needs.

[0118] For example, debuggers can directly modify the Ajax mapping table located in a designated directory on the web server or set-top box, remove records corresponding to certain Ajax requests, or modify the cache flag. To replace a request with specified response content, simply modify the Content field to the desired response content. To debug the processing logic for each stage of a request's state change, simply modify the OnReadyStateChange field to the desired state change event response logic, causing the browser's JavaScript engine to use the customized content to replace the OnReadyStateChange callback method of the XMLHttpRequest object corresponding to this request.

[0119] Furthermore, in one embodiment, after the step of modifying the Ajax mapping table on the Web server and / or set-top box side based on the operation instruction, the method further includes:

[0120] The modified Ajax mapping table is loaded; for each record in the modified Ajax mapping table, the content that does not exist in the Ajax mapping table is deleted from the cache.

[0121] In this embodiment, the debugger sends a refresh command to the browser, such as pressing the home button on the set-top box's infrared remote control. After the browser detects the refresh command, it reloads the debug page entry address, triggering an update of the Ajax mapping table. The browser then requests the modified Ajax mapping table from the web server or directly loads it from the box.

[0122] For each record in the modified Ajax mapping table, if the content of the record exists in the cache but not in the Ajax mapping table, the content is deleted from the cache. The detection action here is performed by the browser kernel.

[0123] Furthermore, in one embodiment, each record in the Ajax mapping table further includes a state change event field corresponding to an Ajax request, and after the step of loading the modified Ajax mapping table, the following steps are further included:

[0124] For each record in the modified Ajax mapping table, when it is detected that the field content of the state change event field is not the default value, the JavaScript engine is used to parse it, and the OnReadyStateChange callback method of the XMLHttpRequest object corresponding to the corresponding Ajax request is replaced with the parsed result.

[0125] In this embodiment, each record in the Ajax mapping table also includes a state change event field (OnReadyStateChange) corresponding to the Ajax request. After the set-top box detects the contents of this field, it uses the JavaScript engine to parse and replace the OnReadyStateChange callback method of the XMLHttpRequest object corresponding to the Ajax request. This allows debuggers to debug the state change logic of the Ajax request without modifying the original EPG page. The default value is empty, which means that the original OnReadyStateChange callback event logic of the EPG page is used.

[0126] Further, refer to Figure 3 , Figure 3 This is a comparison diagram of the embodiment of the present application and the traditional Ajax request method. Figure 3 As shown, the dotted box mark portion is the portion that distinguishes this embodiment from the traditional Ajax request:

[0127] When configured to request the web server, the browser process, upon startup and detection of a refresh command (such as when the home button is pressed), requests the web server for the Ajax mapping table through the network module (Net), extracting the request list, response status code, and response type that need to be cached. When configured to local request mode, the browser process, upon startup and detection of a refresh command, reads the Ajax mapping table from the specified directory on the set-top box through the I / O thread, without requiring network interaction with the web server.

[0128] The local request mode is designed to facilitate debugging personnel to modify the Ajax mapping table directly on the set-top box, without the need to interact with the web server. Modifications can be made in real time and take effect immediately, which is mainly for the purpose of more convenient debugging. If the Ajax mapping table is not modified frequently, the Ajax mapping table can be stored on the web server side, that is, configured to request the web server mode. Of course, it is also possible to save storage space on the set-top box itself, so the Ajax mapping table can be stored on the web server side, thus configuring it to request the web server mode.

[0129] When the browser Render process initiates an Ajax request, if it is detected that the request is in the Ajax mapping table and the response code is in the range of [200, 300) and the response content field is invalid, if the cache flag is 1, the browser kernel resource loading class ResourceFetcher (a class dedicated to resource acquisition in the browser kernel, responsible for initiating network requests and various status and error handling during resource acquisition) reads the response content from the cache (MemoryCache). If the read fails, the traditional Ajax request process is used (through IPC, the Net module of the Browser process requests the Web server, that is, obtains the response content from the EPG resource). When it is detected that the response code corresponding to the request in the Ajax mapping table is an abnormal response such as HTTP400, there is no need to wait for interaction with the Web server, and the response exception is directly handled. This is manifested as the response exception logic directly following the EPG page, quickly implementing the Ajax response status configuration.

[0130] In a second aspect, an embodiment of the present invention further provides an EPG page restoration device.

[0131] In one embodiment, referring to Figure 4 , Figure 4 Schematic diagram of the functional modules of an embodiment of the EPG page restoration device of the present invention. Figure 4 As shown, the EPG page restoration device includes:

[0132] A table loading module 10 is used to load an Ajax mapping table. The Ajax mapping table is constructed based on the parsing result of the electronic program guide (EPG) data packet. Each record in the Ajax mapping table includes a request address field, a cache flag field, and a response content field corresponding to an Ajax request.

[0133] A preloading module 20 is used to preload high-priority Ajax requests corresponding to high-priority records in the Ajax mapping table before loading the EPG page;

[0134] The page loading module 30 is used to determine, for each Ajax request, a target record with the same request address field in the Ajax mapping table during the loading of the EPG page;

[0135] If the response content field of the target record is valid, then obtain the response content field of the target record from the Ajax mapping table;

[0136] If the response content field of the target record is invalid and the cache flag field is the first character, then check whether the target response content corresponding to the target record exists in the cache;

[0137] If the target response content corresponding to the target record exists in the cache, the target response content is obtained from the cache.

[0138] Furthermore, in one embodiment, each record in the Ajax mapping table further includes a request priority field, and the preloading module 20 is configured to:

[0139] Traverse each record in the Ajax mapping table, and if the request priority field of the record is a preset character, it is determined to be a high priority record;

[0140] For each high-priority record, if the response content field of the high-priority record is valid, obtain the response content field of the high-priority record from the Ajax mapping table;

[0141] If the response content field of the high-priority record is invalid and the cache flag field is the first character, then check whether the response content corresponding to the high-priority record exists in the cache;

[0142] If the response content corresponding to the high-priority record exists in the cache, the response content corresponding to the high-priority record is obtained from the cache.

[0143] Furthermore, in one embodiment, the preloading module 20 is further configured to:

[0144] If the response content field of the high-priority record is invalid and the cache flag field is the second character, then send a high-priority Ajax request corresponding to the high-priority record to the web server, and receive the response content fed back by the web server based on the high-priority Ajax request;

[0145] After the step of detecting whether there is response content corresponding to the high-priority record in the cache, the method further includes:

[0146] If the response content corresponding to the high-priority record does not exist in the cache, a high-priority Ajax request corresponding to the high-priority record is sent to the Web server;

[0147] Receive the response content fed back by the Web server based on the high-priority Ajax request, and store it in the cache.

[0148] Furthermore, in one embodiment, the page loading module 30 is configured to:

[0149] If the response content field of the target record is invalid and the cache flag field is the second character, then send the target Ajax request corresponding to the target record to the web server, and receive the response content fed back by the web server based on the target Ajax request;

[0150] If the target response content corresponding to the target record does not exist in the cache, the target Ajax request corresponding to the target record is sent to the Web server;

[0151] Receive the response content fed back by the Web server based on the target Ajax request and store it in the cache.

[0152] Furthermore, in one embodiment, the EPG page restoration device further includes a construction module for:

[0153] Parse EPG data packets frame by frame and filter out HTTP messages;

[0154] For each HTTP message, if the HTTP message is a request message, the destination IP address of the request message is used as the root directory, and resource file directories with the same name as the request address of the request message are created step by step; if the request message is an Ajax request, a new record is added to the Ajax mapping table, and the request address corresponding to the Ajax request is written into the request address field of the new record, and the first character is written into the cache flag field of the new record;

[0155] If the HTTP message is a response message, the response message is parsed to obtain the response content, response code, and response type, and the response content is written to the resource file directory with the same name as the request address of the HTTP request corresponding to the response message; if the response message is a response message corresponding to an Ajax request, the response code and response type are written into the response code field and response type field of the specific record in the Ajax mapping table respectively, and the specific record is the record corresponding to the Ajax request corresponding to the response message;

[0156] After all HTTP messages are traversed, the Ajax mapping table is transmitted to the Web server and / or set-top box, and the folder corresponding to the resource file directory is transmitted to the Web server.

[0157] Furthermore, in one embodiment, the EPG page restoration apparatus further includes a first modification module configured to:

[0158] Receive an operation instruction, and perform a modification operation on the Ajax mapping table on the Web server and / or set-top box side based on the operation instruction, wherein the modification operation includes a new record operation, a record deletion operation, and a field modification operation.

[0159] Furthermore, in one embodiment, the EPG page restoration apparatus further includes a second modification module, configured to:

[0160] Load the modified Ajax mapping table;

[0161] For each record in the modified Ajax mapping table, the content that does not exist in the Ajax mapping table is deleted from the cache.

[0162] Furthermore, in one embodiment, each record in the Ajax mapping table further includes a state change event field corresponding to an Ajax request, and the page loading module is further configured to:

[0163] For each record in the modified Ajax mapping table, when it is detected that the field content of the state change event field is not the default value, the JavaScript engine is used to parse it, and the OnReadyStateChange callback method of the XMLHttpRequest object corresponding to the corresponding Ajax request is replaced with the parsed result.

[0164] The functions of the modules in the EPG page restoration device correspond to the steps in the above-mentioned EPG page restoration method embodiment, and their functions and implementation processes are not described in detail here.

[0165] In a third aspect, an embodiment of the present invention provides an EPG page restoration device.

[0166] Reference Figure 5 , Figure 5 This is a schematic diagram of the hardware structure of the EPG page restoration device involved in the embodiment of the present invention. In the embodiment of the present invention, the EPG page restoration device may include a processor 1001 (such as a central processing unit (CPU)), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components; the user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard); the network interface 1004 may optionally include a standard wired interface, a wireless interface (such as a wireless fidelity WIreless-FIdelity, WI-FI interface); the memory 1005 may be a high-speed random access memory (RAM) or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001. Those skilled in the art will understand that Figure 5 The hardware structure shown in the figure does not constitute a limitation of the present invention, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0167] Continue to refer to Figure 5 , Figure 5 The memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and an EPG page restoration program. The processor 1001 may call the EPG page restoration program stored in the memory 1005 and execute the EPG page restoration method provided in the embodiment of the present invention.

[0168] In a fourth aspect, an embodiment of the present invention further provides a readable storage medium.

[0169] The readable storage medium of the present invention stores an EPG page restoration program, wherein when the EPG page restoration program is executed by a processor, the steps of the above-mentioned EPG page restoration method are implemented.

[0170] The method implemented when the EPG page restoration program is executed may refer to the various embodiments of the EPG page restoration method of the present invention, and will not be described in detail here.

[0171] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or system comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or system. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or system comprising the element.

[0172] The serial numbers of the above embodiments of the present invention are for description only and do not represent the advantages or disadvantages of the embodiments.

[0173] Through the description of the above embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, or of course by hardware, but in many cases the former is a better embodiment. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for enabling a terminal device to execute the methods described in various embodiments of the present invention.

[0174] The above are only preferred embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention description and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A method for restoring an EPG page, characterized in that: The EPG page restoration method comprises: Loading an Ajax mapping table, wherein the Ajax mapping table is constructed based on the parsing result of the electronic program guide (EPG) data packet, wherein each record in the Ajax mapping table includes a request address field, a cache flag field, and a response content field corresponding to an Ajax request; Before loading the EPG page, preload the high-priority Ajax requests corresponding to the high-priority records in the Ajax mapping table; During the loading of the EPG page, for each Ajax request, a target record with the same request address field is determined in the Ajax mapping table; If the response content field of the target record is valid, then obtain the response content field of the target record from the Ajax mapping table; If the response content field of the target record is invalid and the cache flag field is the first character, then check whether the target response content corresponding to the target record exists in the cache; If the target response content corresponding to the target record exists in the cache, the target response content is obtained from the cache.

2. The EPG page restoration method according to claim 1, wherein: Each record in the Ajax mapping table further includes a request priority field. The step of preloading high-priority Ajax requests corresponding to high-priority records in the Ajax mapping table includes: Traverse each record in the Ajax mapping table, and if the request priority field of the record is a preset character, it is determined to be a high priority record; For each high-priority record, if the response content field of the high-priority record is valid, obtain the response content field of the high-priority record from the Ajax mapping table; If the response content field of the high-priority record is invalid and the cache flag field is the first character, then check whether the response content corresponding to the high-priority record exists in the cache; If the response content corresponding to the high-priority record exists in the cache, the response content corresponding to the high-priority record is obtained from the cache.

3. The EPG page restoration method according to claim 2, wherein: After the step of determining the record as a high priority record, the method further includes: If the response content field of the high-priority record is invalid and the cache flag field is the second character, then send a high-priority Ajax request corresponding to the high-priority record to the web server, and receive the response content fed back by the web server based on the high-priority Ajax request; After the step of detecting whether there is response content corresponding to the high-priority record in the cache, the method further includes: If the response content corresponding to the high-priority record does not exist in the cache, a high-priority Ajax request corresponding to the high-priority record is sent to the Web server; Receive the response content fed back by the Web server based on the high-priority Ajax request, and store it in the cache.

4. The EPG page restoration method according to claim 1, wherein: After the step of determining, in the Ajax mapping table, a target record having the same request address field as each Ajax request, the method further includes: If the response content field of the target record is invalid and the cache flag field is the second character, then send the target Ajax request corresponding to the target record to the web server, and receive the response content fed back by the web server based on the target Ajax request; After the step of detecting whether the target response content corresponding to the target record exists in the cache, the method further includes: If the target response content corresponding to the target record does not exist in the cache, the target Ajax request corresponding to the target record is sent to the Web server; Receive the response content fed back by the Web server based on the target Ajax request and store it in the cache.

5. The EPG page restoration method according to claim 1, wherein: Before loading the Ajax mapping table, the following steps are also included: Parse EPG data packets frame by frame and filter out HTTP messages; For each HTTP message, if the HTTP message is a request message, the destination IP address of the request message is used as the root directory, and resource file directories with the same name as the request address of the request message are created step by step; if the request message is an Ajax request, a new record is added to the Ajax mapping table, and the request address corresponding to the Ajax request is written into the request address field of the new record, and the first character is written into the cache flag field of the new record; If the HTTP message is a response message, the response message is parsed to obtain the response content, response code, and response type, and the response content is written to the resource file directory with the same name as the request address of the HTTP request corresponding to the response message; if the response message is a response message corresponding to an Ajax request, the response code and response type are written into the response code field and response type field of the specific record in the Ajax mapping table respectively, and the specific record is the record corresponding to the Ajax request corresponding to the response message; After all HTTP messages are traversed, the Ajax mapping table is transmitted to the Web server and / or set-top box, and the folder corresponding to the resource file directory is transmitted to the Web server.

6. The EPG page restoration method according to claim 5, wherein: After the step of transmitting the Ajax mapping table to the Web server and / or the set-top box, the method further includes: Receive an operation instruction, and perform a modification operation on the Ajax mapping table on the Web server and / or set-top box side based on the operation instruction, wherein the modification operation includes a new record operation, a record deletion operation, and a field modification operation.

7. The EPG page restoration method according to claim 6, wherein: After the step of modifying the Ajax mapping table on the Web server and / or set-top box side based on the operation instruction, the method further includes: Load the modified Ajax mapping table; For each record in the modified Ajax mapping table, the content that does not exist in the Ajax mapping table is deleted from the cache.

8. The EPG page restoration method according to claim 7, wherein: Each record in the Ajax mapping table further includes a state change event field corresponding to an Ajax request. After the step of loading the modified Ajax mapping table, the method further includes: For each record in the modified Ajax mapping table, when it is detected that the field content of the state change event field is not the default value, the JavaScript engine is used to parse it, and the OnReadyStateChange callback method of the XMLHttpRequest object corresponding to the corresponding Ajax request is replaced with the parsed result.

9. An EPG page restoration device, characterized in that: The EPG page restoration device comprises: A table loading module is used to load an Ajax mapping table, wherein the Ajax mapping table is constructed based on the parsing result of the electronic program guide (EPG) data packet, and each record in the Ajax mapping table includes a request address field, a cache flag field, and a response content field corresponding to an Ajax request; The preloading module is used to preload the high-priority Ajax requests corresponding to the high-priority records in the Ajax mapping table before loading the EPG page; The page loading module is used to determine the target record with the same request address field in the Ajax mapping table for each Ajax request during the loading of the EPG page; If the response content field of the target record is valid, then obtain the response content field of the target record from the Ajax mapping table; If the response content field of the target record is invalid and the cache flag field is the first character, then check whether the target response content corresponding to the target record exists in the cache; If the target response content corresponding to the target record exists in the cache, the target response content is obtained from the cache.

10. An EPG page restoration device, characterized in that: The EPG page restoration device includes a processor, a memory, and an EPG page restoration program stored in the memory and executable by the processor, wherein when the EPG page restoration program is executed by the processor, the steps of the EPG page restoration method according to any one of claims 1 to 8 are implemented.

Citation Information

Patent Citations

  • Recommendation system and method based on IPTV EPG running logs

    CN112672189A

  • Front-end micro-servitization method and device, computer equipment and storage medium

    CN113010224A