CN110390065B - Webpage acquisition method, device and system - Google Patents
Webpage acquisition method, device and system Download PDFInfo
- Publication number
- CN110390065B CN110390065B CN201910703588.XA CN201910703588A CN110390065B CN 110390065 B CN110390065 B CN 110390065B CN 201910703588 A CN201910703588 A CN 201910703588A CN 110390065 B CN110390065 B CN 110390065B
- Authority
- CN
- China
- Prior art keywords
- webpage
- file
- web page
- user request
- storage server
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 133
- 230000008569 process Effects 0.000 claims abstract description 50
- 238000013507 mapping Methods 0.000 claims description 9
- 238000012545 processing Methods 0.000 abstract description 31
- 238000010586 diagram Methods 0.000 description 16
- 230000004044 response Effects 0.000 description 16
- 230000006870 function Effects 0.000 description 11
- 230000002093 peripheral effect Effects 0.000 description 10
- 230000001133 acceleration Effects 0.000 description 9
- 238000004891 communication Methods 0.000 description 9
- 238000005516 engineering process Methods 0.000 description 6
- 230000003287 optical effect Effects 0.000 description 6
- 238000009877 rendering Methods 0.000 description 6
- 238000012544 monitoring process Methods 0.000 description 3
- 230000003068 static effect Effects 0.000 description 3
- 238000013473 artificial intelligence Methods 0.000 description 2
- 239000000919 ceramic Substances 0.000 description 2
- 230000006835 compression Effects 0.000 description 2
- 238000007906 compression Methods 0.000 description 2
- 238000004904 shortening Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 230000004927 fusion Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 230000001788 irregular Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000010801 machine learning Methods 0.000 description 1
- 239000000463 material Substances 0.000 description 1
- 230000005055 memory storage Effects 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
- 230000002035 prolonged effect Effects 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 230000006641 stabilisation Effects 0.000 description 1
- 238000011105 stabilization Methods 0.000 description 1
- 239000010409 thin film Substances 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/957—Browsing optimisation, e.g. caching or content distillation
- G06F16/9574—Browsing optimisation, e.g. caching or content distillation of access to content, e.g. by caching
Landscapes
- Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Transfer Between Computers (AREA)
Abstract
The invention discloses a webpage acquisition method, device and system, and belongs to the technical field of webpages. In the method, the background device may generate at least one web page file in advance and store the web page file in the storage server, and the storage server may return the web page file corresponding to the user request to the user terminal according to the user request sent by the user terminal. Because the user terminal can directly acquire and access the webpage file generated based on the DOM tree and SSR processing, the user terminal does not need to acquire the webpage data and generate the DOM tree and the webpage file according to the user request, the time consumption for acquiring the webpage is reduced to a great extent, and the webpage acquisition process is simplified.
Description
Technical Field
The present invention relates to the field of web page technologies, and in particular, to a web page obtaining method, device and system.
Background
Server side rendering (english: server Side Rendering, abbreviated: SSR) refers to a process in which a server, after acquiring data corresponding to a user request, fills the data into a web page template stored in the server side to generate a web page file. The client may display the corresponding web page by parsing the web page file.
In the related art, a method for acquiring a webpage based on an SSR is provided, in the method, after receiving a user request sent by a client, an SSR server generates a corresponding data interface according to the user request and sends the data interface to a back-end server, the back-end server acquires corresponding page data from a database according to the data interface and returns the corresponding page data to the SSR server, the SSR server generates a document object model (Document Object Model, DOM) tree based on the page data, performs SSR processing on the page data based on the DOM tree to obtain a webpage file, and sends the webpage file to the client, and the client acquires the webpage file and displays a corresponding webpage.
In the method for acquiring the webpage, the SSR server is required to search the corresponding data interface in real time according to the user request to acquire the webpage data, and generate the DOM tree and the webpage file in real time, so that the process for acquiring the webpage is complex and the time is long.
Disclosure of Invention
The embodiment of the invention provides a webpage acquisition method, device and system, which can solve the technical problems in the related technology. The technical scheme is as follows:
according to a first aspect of the present invention, there is provided a web page acquisition method, the method being applied to a background device, the method comprising:
Acquiring data of at least one webpage;
generating at least one webpage file according to the data of the at least one webpage and a webpage template, wherein the webpage template is generated based on a Document Object Model (DOM) tree;
and storing the at least one webpage file to a storage server, wherein the storage server is used for providing the webpage file corresponding to the user request in the at least one webpage file for the user terminal according to the user request of the user terminal.
Optionally, the method further comprises:
when the data of the target webpage in the at least one webpage is detected to be updated, generating an updated webpage file corresponding to the target webpage according to the updated data and the webpage template;
and storing the updated webpage file to the storage server, wherein the storage server is used for updating the webpage file of the target webpage into the updated webpage file.
Optionally, the data of the at least one web page includes data of a web page header screen.
According to a second aspect of the present invention, there is provided a web page acquisition method, the method being applied to a storage server, the method comprising:
receiving and storing at least one webpage file provided by background equipment;
Acquiring a user request of a user terminal;
according to the user request, searching whether a webpage file corresponding to the user request exists in the at least one webpage file;
and when the webpage file corresponding to the user request exists, sending the webpage file corresponding to the user request to the user terminal.
Optionally, the method further comprises:
and when receiving an updated webpage file corresponding to a target webpage in the at least one webpage file, updating the webpage file of the target webpage into the updated webpage file.
According to a third aspect of the present invention, there is provided a web page acquisition method, the method being applied to a user terminal, the method comprising:
acquiring operation information of a user;
determining a user request according to the operation information, wherein the user request is used for indicating a webpage address;
sending the user request to a storage server, wherein the storage server stores at least one webpage file;
and receiving a webpage file corresponding to the user request and fed back by the storage server.
According to a fourth aspect of the present invention, there is provided a web page acquisition apparatus, the apparatus being applied to a background device, the apparatus comprising:
The first acquisition module is used for acquiring data of at least one webpage;
the generation module is used for generating at least one webpage file according to the data of the at least one webpage and a webpage template, and the webpage template is generated based on a Document Object Model (DOM) tree;
the storage module is used for storing the at least one webpage file to a storage server, and the storage server is used for providing the webpage file corresponding to the user request in the at least one webpage file for the user terminal according to the user request of the user terminal.
According to a fifth aspect of the present invention, there is provided a web page acquisition apparatus, the apparatus being applied to a storage server, the apparatus comprising:
the first receiving module is used for receiving and storing at least one webpage file provided by the background equipment;
the second acquisition module is used for acquiring a user request of the user terminal;
the searching module is used for searching whether the at least one webpage file exists in the webpage files corresponding to the user request according to the user request;
and the first sending module is used for sending the webpage file corresponding to the user request to the user terminal when the webpage file corresponding to the user request exists.
According to a sixth aspect of the present invention, there is provided a web page acquisition apparatus, the apparatus being applied to a user terminal, the apparatus comprising:
the third acquisition module is used for acquiring the operation information of the user;
the determining module is used for determining a user request according to the operation information, wherein the user request is used for indicating a webpage address;
the second sending module is used for sending the user request to a storage server, and the storage server stores at least one webpage file;
and the second receiving module is used for receiving the webpage file corresponding to the user request and fed back by the storage server.
According to a seventh aspect of the present invention, there is provided a web page acquisition system, the system comprising: background equipment, a storage server and a user terminal;
the background device comprises the webpage acquiring device according to the fourth aspect, the storage server comprises the webpage acquiring device according to the fifth aspect, and the user terminal comprises the webpage acquiring device according to the sixth aspect.
The technical scheme provided by the embodiment of the invention has the beneficial effects that at least:
the background device may generate at least one web page file in advance and store the web page file in the storage server, and the storage server may return, to the user terminal, the web page file corresponding to the user request according to the user request sent by the user terminal. Because the user terminal can directly acquire and access the webpage file generated based on the DOM tree and SSR processing, the user terminal does not need to acquire the webpage data and generate the DOM tree and the webpage file according to the user request, the time consumption for acquiring the webpage is reduced to a great extent, and the webpage acquisition process is simplified.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of an implementation environment of a web page acquisition method provided by the related art;
FIG. 2 is a schematic diagram of an implementation environment of a web page obtaining method according to an embodiment of the present invention;
FIG. 3 is a flowchart of a method for acquiring a web page according to an embodiment of the present invention;
FIG. 4 is a flowchart of another method for acquiring a web page according to an embodiment of the present invention;
FIG. 5 is a flowchart of a method for obtaining a web page according to an embodiment of the present invention;
FIG. 6 is a flowchart of a method for obtaining a web page according to an embodiment of the present invention;
FIG. 7 is a schematic diagram of an implementation environment of a web page obtaining method according to another embodiment of the present invention;
FIG. 8 is a graph showing the time-consuming comparison between the first screen acquired by the web page acquisition method according to the embodiment of the present invention and the first screen acquired by the web page acquisition method according to the related art;
FIG. 9 illustrates the time periods respectively consumed by the two web page acquisition methods described in FIG. 8 during a monitoring period of 0 to 24 hours;
FIG. 10 is a block diagram of a web page obtaining apparatus according to an embodiment of the present invention;
FIG. 11 is a block diagram of a web page obtaining apparatus according to an embodiment of the present invention;
FIG. 12 is a block diagram of a web page obtaining apparatus according to still another embodiment of the present invention;
fig. 13 is a schematic structural diagram of a server according to an embodiment of the present application;
fig. 14 is a schematic structural diagram of a terminal according to an embodiment of the present application.
Specific embodiments of the present invention have been shown by way of the above drawings and will be described in more detail below. The drawings and the written description are not intended to limit the scope of the inventive concepts in any way, but rather to illustrate the inventive concepts to those skilled in the art by reference to the specific embodiments.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present invention more apparent, the embodiments of the present invention will be described in further detail with reference to the accompanying drawings.
Fig. 1 is a schematic diagram showing an implementation environment of a web page acquisition method in the related art. The implementation environment may be applied to a web page acquisition system 00, which may include: at least one user terminal 01, an SSR server 02 and a backend server 03.
In the webpage acquisition method described in the related art, firstly, an SSR server (also referred to as a node server of an SSR) is constructed by adopting an SSR source code, and the SSR server is used for generating an executable file, for example, an executable file with a suffix of ". Bundle", and the executable file is used for performing the SSR; and then executing the webpage acquisition method. The webpage acquisition method comprises the following steps: when the user terminal 01 sends a user request to the SSR server 02, the SSR server 02 parses an asynchronous data interface required by a uniform resource locator (Uniform Resource Locator, URL) in the current user request according to a previously generated executable file, and forwards the parsed asynchronous data interface to a data interface of the back-end server 03, and the back-end server 03 obtains interface data (may also be referred to as web page data) corresponding to the asynchronous data interface in a directory-cache (dcache), a database or other data sources through the data interface, and returns the interface data to the SSR server 02, and the SSR server 02 performs SSR on the interface data and returns the web page file after SSR processing to the user terminal 01.
As can be seen from the above-mentioned webpage obtaining method, in the related art, the process from the time when the user terminal 01 sends the user request to the time when the user terminal 01 obtains the webpage file corresponding to the user request is complex, which consumes a long time and seriously affects the user experience. In addition, in order to ensure that the web page acquisition method can be performed normally, the SSR server 02 and the backend server 03 are required to be online normally at the same time, and this situation causes great stress on the stability of the implementation environment 00. And during periods of user request surge, the load on SSR server 02 can also be put significant stress.
Also, in other related arts, the process of SSR processing of the interface data by the SSR server 02 includes a process of single page web application (single page web application, SPA, also referred to as single page application) processing of the interface data and an SSR processing process, that is, the SSR processing process is based on a single page application. In the process of performing SPA processing and SSR processing on interface data, firstly, the SSR server 02 generates a DOM tree according to the interface data, then further generates a web page template required by the SSR according to the generated DOM number, and finally generates a web page file based on the web page template and the interface data.
From this process, it can be seen that if the web page file is generated based on the SPA process and the SSR process, the DOM tree is generated in a longer time, so that the process of obtaining the web page file by the user is longer, and the response time is further prolonged.
Fig. 2 is a schematic diagram of an implementation environment of a web page obtaining method according to an embodiment of the present invention, where the implementation environment may be applied to a web page obtaining system 10, and the web page obtaining system may include: a background device 11, a storage server 12 and at least one user terminal 13. The web page acquisition system 10 shown in fig. 2 includes a user terminal 13.
The background device 11 may include a terminal and a server, and is configured to generate a web page file; the storage server 12 may be a server, a server cluster formed by a plurality of servers, or a cloud computing center, and the storage server 12 may be a cloud server (also called a cloud server or a cloud) or a Container (english: container, an operating system level virtualization technology); the user terminal 13 may be a smart device such as a smart phone, a computer or a tablet computer capable of browsing web pages.
The communication connection between the at least one user terminal 13 and the storage server 12 may be established through a wired network or a wireless network, and the communication connection between the backend device 11 and the storage server 12 may also be established through a wired network or a wireless network.
Fig. 3 is a flowchart of a method for acquiring a web page according to an embodiment of the present invention, where the method may be applied to a background device, and the background device may be the background device 11 in the implementation environment shown in fig. 2, and the method may include:
step 301, obtaining data of at least one webpage.
Step 302, generating at least one web page file according to the data of the at least one web page and a web page template, wherein the web page template is generated based on the DOM tree.
Step 303, storing the at least one web page file in a storage server, where the storage server is configured to provide, according to a user request of the user terminal, a web page file corresponding to the user request in the at least one web page file to the user terminal.
In summary, according to the webpage obtaining method provided by the embodiment of the present invention, the background device generates at least one webpage file according to the data of at least one webpage and the webpage template, and stores the at least one webpage file in the storage server. After receiving the user request, the storage server can directly acquire the webpage file generated based on the DOM tree and SSR processing corresponding to the user request from the storage server, and the user does not need to acquire the webpage data and generate the DOM tree and the webpage file in real time according to the user request, so that the flow of the webpage acquisition method is simplified, and the response time is shortened.
Fig. 4 is a flowchart of another web page obtaining method according to an embodiment of the present invention, where the method may be applied to a storage server, which may be the storage server 12 in the implementation environment shown in fig. 2, and the method may include:
step 401, at least one web page file provided by a background device is received and stored.
Step 402, obtaining a user request of a user terminal.
Step 403, searching whether a web page file corresponding to the user request exists in the at least one web page file according to the user request.
And step 404, when the web page file corresponding to the user request exists, sending the web page file corresponding to the user request to the user terminal.
In summary, according to the webpage obtaining method provided by the embodiment of the invention, the storage server receives and stores at least one webpage file generated based on the DOM tree and the SSR process provided by the background device, so that the storage server can search whether the stored at least one webpage file generated based on the DOM tree and the SSR process exists in the webpage file according to the obtained user request, and when the webpage file exists, the storage server directly sends the webpage file to the user terminal, and does not need to obtain the webpage data in real time according to the user request and generate the DOM tree and the webpage file, thereby shortening the response time.
Fig. 5 is a flowchart of yet another web page obtaining method according to an embodiment of the present invention, where the method may be applied to a user terminal, and the user terminal may be one of the at least one user terminals 13 in the implementation environment shown in fig. 2, and the method may include:
Step 501, obtaining operation information of a user.
Step 502, determining a user request according to the operation information, wherein the user request is used for indicating the webpage address.
Step 503, a user request is sent to a storage server, where at least one web page file is stored.
Step 504, receiving a web page file corresponding to the user request fed back by the storage server.
In summary, according to the webpage acquisition method provided by the embodiment of the invention, the user terminal sends the user request for indicating the webpage address to the storage server, so that the user terminal can receive the webpage file which is fed back by the storage server and corresponds to the user request and is generated based on the DOM tree and SSR processing, the user terminal does not need to acquire the webpage data in real time according to the user request and generate the DOM tree and the webpage file, the flow of the webpage acquisition method is obviously simplified, and the response time is shortened.
Fig. 6 is a flowchart of still another web page obtaining method according to an embodiment of the present invention. The method can be applied to the web page acquisition system shown in fig. 2. The method may include:
step 601, the background device acquires data of at least one webpage.
The background device may obtain data for at least one web page from a database or cache. The database or cache may be provided in the background device or be an external device connected to the background device by a wired or wireless means.
The data of the at least one web page may be part of the web pages stored in the database or in the cache. In order to better meet the access requirement of the user to the webpage file, the background device may adopt various implementation manners to acquire the data of the part of the webpage. For example, the background device may count at least one web page with the highest access frequency of the user, and then the background device obtains data of the at least one web page; for another example, the data of the at least one web page may include data of a first screen, and since the first screen is the first interface for the user to enter the website, if the response time of the first screen is long, a bad user experience may be brought to the user, which may cause the user to leave the website. Therefore, by acquiring the data comprising the first screen of the webpage, the background equipment can quickly respond and present the webpage corresponding to the user request to the user when the user request is the request to access the first screen of the webpage, so that the response time is effectively shortened, and the user experience is optimized. Alternatively, the web page first screen may include a homepage, an announcement page, an information promotion page, and the like of the web site.
Alternatively, the database or cache may correspond to a certain application or a certain website. For example, the database or cache may correspond to a game site, and store data for a plurality of web pages associated with the game site. The data of the at least one web page may be data of a portion of the web page stored in a database or cache for a certain application or a certain website. Of course, the data of the at least one web page may also be data of all web pages for the application program or the website stored in the database or the cache, so that the storage server may send any one of the web page files corresponding to the user request for the application program or the website to the user terminal, so as to meet the access requirement of the user for all the web page files.
Alternatively, the data of the web page may be stored in JSON (JavaScript Object Notation) file format. It should be noted that, the data of the at least one web page may be data for describing a static web page, and is non-user related data, which cannot be changed by a user.
Step 602, the background device generates at least one web page file according to the data of the at least one web page and the web page template.
Wherein the web page template may include at least one web page sub-template (or template file), each of which may be used to generate a style web page file. The web page template is generated based on the DOM tree.
In step 602, the background device generates at least one web page file according to the data of the at least one web page and the web page template, which may be regarded as a process of implementing RRS, that is, the background device parses the web page template stored in the background device to fill the data of the at least one web page into the web page template (that is, fill the data of the at least one web page into the corresponding template file) so as to generate the web page file, where the web page file is used for displaying by the user terminal according to the browser in the operating system of the user terminal. In addition, since the web page template is generated based on the DOM tree, the generation of at least one web page file by the background device according to the data of the at least one web page and the web page template can be regarded as a process of implementing the single page application and the RRS. The web page file may be considered a string that generates a web page, for example, a hypertext markup language (Hyper Text Markup Language, HTML) file may be considered a string that generates an HTML file.
It should be noted that, the background device stores the page source code for implementing the SSR function in advance. The page source code is used to provide an interpreted script language (JS) required for generating a web page file, and to rely on a resource manifest file (manifest). In addition, the page source code also comprises a hook function for triggering the generation of the webpage file. The hook function can generate the webpage file from the JSON file in a prerendering mode. The prerendering is a server side rendering mode and is used for generating static webpage files.
Step 603, the background device stores the at least one web page file in a storage server.
The background equipment uploads the generated at least one webpage file to a storage server for storage, and the storage server is used for providing the user terminal with the corresponding webpage file in the at least one webpage file according to the user request of the user terminal.
Step 604, when the background device detects that the data of the target webpage in at least one webpage is updated, generating an updated webpage file corresponding to the target webpage according to the updated data and the webpage template.
The data of the web page stored in the server or the cache may be updated, and the update data includes operations of modifying the data, deleting the data, modifying the data, and the like. The data may include configuration data, etc.
When the background device detects that the data of the target webpage in at least one webpage is updated, the JSON file storing the data of the webpage can be modified. At this time, the background device may generate an updated web page file corresponding to the target web page by calling a hook function in the page source code according to the updated data and the web page template.
In addition, since the data of the target web page may be used to generate a plurality of web page files, that is, the data of the target web page may be associated with a plurality of web page files, the background device may determine at least one web page file associated with the data of the target web page and acquire a web page template corresponding to the at least one web page file to generate at least one updated web page file. When the original data is updated to new data, at least one webpage file associated with the original data is updated so as to obtain a new webpage file corresponding to the updated data. Therefore, the effectiveness of the webpage file finally acquired by the user is ensured.
Step 605, the background device stores the updated web page file in a storage server.
The storage server is configured to update the web page file of the target web page to the updated web page file generated in step 604.
Step 606, when the storage server receives the updated web page file corresponding to the target web page in the at least one web page file, updating the web page file of the target web page stored in the storage server to the updated web page file.
The updated webpage file is generated by the background equipment according to the updated data and the webpage template when the background equipment detects that the data of the target webpage in at least one webpage is updated.
Step 607, the user terminal obtains the operation information of the user.
The operation information may be a click operation by the user for a certain identification on a certain website displayed by the client in the user terminal.
Step 608, the user terminal determines a user request according to the operation information, where the user request is used to indicate a web page address.
The user request may include a URL indicating a web page address that the user wants to access.
Step 609, the user terminal sends a user request to a storage server, where at least one web page file is stored.
The user terminal may send a user request including the URL to the storage server. The storage server stores at least one web page file, and each web page file corresponds to a storage path (the storage path may also be referred to as URL) in the storage server. The corresponding webpage file can be obtained through the storage path.
Step 610, the storage server obtains a user request of the user terminal.
Step 611, the storage server searches whether a web page file corresponding to the user request exists in at least one web page file according to the user request.
The storage server determines the webpage file stored in the storage path corresponding to the URL according to the URL in the user request.
In step 611, the process of the storage server searching whether the at least one web page file has a web page file corresponding to the user request according to the user request is a process of the storage server mapping the URL in the user request with the storage path of the web page file. The mapping process may be implemented by a designated function in a storage server or may be implemented by a proxy web server, for example nginx (engine x).
For example, URL in the user request is/mobile/radius.html=123, and can be matched to a character string variable name (args) parameter by nginx, and then the URL is mapped to an html file with a storage path of/mobile/radius/id_123.html in the storage server through the args parameter, that is, an id_123.html file stored under the/mobile/radius directory.
Step 612, when there is a web page file corresponding to the user request, the storage server sends the web page file corresponding to the user request to the user terminal.
When a web page file is stored in a storage path corresponding to a URL in a user request, the storage server may transmit the web page file corresponding to the user request to the user terminal.
When there is no storage path corresponding to the URL or there is a storage path corresponding to the URL but no web page file is stored on the storage path, the storage server cannot transmit the web page file corresponding to the user request to the user terminal.
Because the DOM tree is generated in advance according to the data of at least one webpage in the steps, the webpage template is generated based on the DOM tree, at least one webpage file is generated based on the data of the at least one webpage and the webpage template, and the at least one webpage file is stored in the storage server, when the webpage file corresponding to the user request exists in the storage server, the webpage file corresponding to the request can be directly sent to the terminal. The user does not need to wait for the time of generating the DOM tree and the webpage file in real time, so that the time of waiting for the user to request and respond is effectively saved, and the user experience is improved. The acquisition flow of the user to acquire the webpage file based on the SPA and the SSR is optimized.
Step 613, the user terminal receives the web page file corresponding to the user request fed back by the storage server.
After receiving the web page file, the user terminal can display the content of the web page file on the display through a system call provided by an operating system installed in the user terminal for operating the display to display the content.
In summary, according to the webpage obtaining method provided by the embodiment of the present invention, the background device may generate at least one webpage file in advance and store the generated at least one webpage file in the storage server, where the storage server may return, to the user terminal, the webpage file corresponding to the user request according to the user request sent by the user terminal. Because the user terminal can directly acquire and access the webpage file generated based on the DOM tree and SSR processing, the user terminal does not need to acquire the webpage data and generate the DOM tree and the webpage file according to the user request in real time, so that the time for acquiring the webpage is greatly reduced. In addition, because the webpage template is generated based on the DOM tree, the process of acquiring the webpage file based on SPA processing and SSR processing is simplified, and the response time for acquiring the webpage file is shortened.
In addition, when the data corresponding to the webpage file stored in the storage server is updated, a new webpage file can be generated to replace the webpage file in the storage server, so that the user can access the latest effective webpage.
In addition, in the embodiment of the invention, the user can directly access the rendered webpage file stored in the storage server without analyzing the asynchronous data interface corresponding to the URL in the user request, so that an SSR server for analyzing the asynchronous data interface corresponding to the URL in the user request is not required to be arranged, and therefore, the interaction operation among a plurality of servers is not required in the webpage acquisition system, the webpage acquisition system of the webpage acquisition method is simplified, the stability of the webpage acquisition system is improved, and the total duration of the user accessing a certain webpage is reduced to the greatest extent.
Fig. 7 is a schematic diagram illustrating an implementation environment of another web page obtaining method according to an embodiment of the present invention, and the web page obtaining method is described below with reference to the implementation environment described in fig. 2.
The system for acquiring a web page described in the implementation environment shown in fig. 7 includes a user terminal 13, where the storage server 12 is a cloud or a container, and the user terminal 13 is connected to the cloud or the container through a nginx, and the background device 11 includes a back-end server (may also be referred to as an online server) and a database or a cache (cache).
The backend server is configured to obtain data of at least one web page (e.g., a web page header screen) from a database or a cache, and generate a corresponding JSON file from the data. The background device stores front-end ssr source codes and constructors of the ssr source codes, the front-end ssr source codes and the constructors of the ssr source codes can be stored in a back-end server or other devices in the background device, and the page source codes comprise hook functions for triggering generation of webpage files (such as html files). The hook function may generate the JSON file as a web page file by prerendering. The prerendering is a server side rendering mode and is used for generating static webpage files. The generated web page file may be stored to the storage server 12.
When the data of the target web page stored in the database or the cache is updated, an updated JSON file is correspondingly generated, and an updated web page file can be generated according to the updated JSON file by triggering the hook function in the page source code, so as to cover the web page file of the target web page in the storage server 12.
When the user terminal 13 obtains the user request, the nginx obtains the offline generated (i.e. pre-stored in the storage server 12) web page file in the storage server 12 through forwarding after the user request of the user terminal 13 reaches the nginx. The forwarding process refers to a process of mapping the URL in the user request with the storage path of the web page file in the storage server.
Thus, the user can quickly access the webpage file corresponding to the user request sent by the user.
Fig. 8 shows a time-consuming comparison of acquiring a first screen (curve B) by using the web page acquisition method provided by the embodiment of the present invention and acquiring a first screen (curve a) by using the web page acquisition method in the related art. In the coordinate axes shown in fig. 8, the abscissa represents the monitoring period of 0 to 24 hours, and the ordinate represents the response time of acquiring a web page in milliseconds per hour. Fig. 9 shows the response time periods respectively required in the monitoring period of 0 to 24 hours for the two web page acquisition methods described in fig. 8.
As is apparent from fig. 8 and 9, the response time for acquiring the first screen by using the web page acquiring method in the related art is generally longer, the variation range is larger, and the response time ranges from 510 ms to 712 ms; the webpage acquisition method provided by the embodiment of the invention has the advantages that the response time for acquiring the first screen is generally low and stable, and the response time ranges from 148 milliseconds to 189 milliseconds.
Fig. 10 shows a block diagram of a web page obtaining apparatus 80 according to an embodiment of the present invention, where the apparatus 80 is applied to a background device, and the apparatus 80 includes:
a first obtaining module 801, configured to obtain data of at least one web page;
a generating module 802, configured to generate at least one web page file according to the data of the at least one web page and the web page template;
the storage module 803 is configured to store the at least one web page file to a storage server, where the storage server is configured to provide, according to a user request of a user terminal, a web page file corresponding to the user request from among the at least one web page file to the user terminal.
In summary, according to the webpage obtaining method provided by the embodiment of the invention, at least one webpage file is generated according to the data of at least one webpage and the webpage template, and the at least one webpage file is stored in the storage server. After receiving the user request, the storage server can directly acquire the webpage file generated based on DOM tree and SSR processing corresponding to the user request from the storage server, and the user does not need to acquire the webpage data and generate the DOM tree and the webpage file in real time according to the user request, so that the flow of the webpage acquisition method is obviously simplified, and the response time is shortened.
Fig. 11 shows a block diagram of still another web page obtaining apparatus 90 according to an embodiment of the present invention, where the apparatus 90 is applied to a storage server, and the apparatus 90 includes:
the first receiving module 901 is configured to receive and store at least one web page file provided by a background device;
a second obtaining module 902, configured to obtain a user request of a user terminal;
the searching module 903 is configured to search whether a web page file corresponding to the user request exists in the at least one web page file according to the user request;
and the first sending module 904 is configured to send, when a web page file corresponding to the user request exists, the web page file corresponding to the user request to the user terminal.
In summary, according to the webpage acquisition method provided by the embodiment of the invention, by receiving and storing at least one webpage file generated based on the DOM tree and the SSR process provided by the background device, whether the at least one webpage file corresponding to the user request exists in the at least one webpage file generated based on the DOM tree and the SSR process can be searched according to the acquired user request, and when the at least one webpage file exists, the webpage file is directly sent to the terminal, and the webpage data is not required to be acquired in real time according to the user request and the DOM tree and the webpage file are generated, so that the flow of the webpage acquisition method is obviously simplified, and the response time is shortened.
Fig. 12 shows a block diagram of still another web page obtaining apparatus 100 according to an embodiment of the present invention, where the apparatus 100 is applied to a user terminal, and the apparatus 100 includes:
a third obtaining module 101, configured to obtain operation information of a user;
a determining module 102, configured to determine a user request according to the operation information, where the user request is used to indicate a web page address;
a second sending module 103, configured to send the user request to a storage server, where the storage server stores at least one web page file;
and the second receiving module 104 is configured to receive a web page file corresponding to the user request, which is fed back by the storage server.
In summary, by sending the user request for indicating the web page address to the storage server, the web page acquisition device provided by the embodiment of the invention enables the user terminal to receive the web page file generated based on the DOM tree and the SSR processing corresponding to the user request fed back by the storage server, and does not need to acquire the web page data and generate the DOM tree and the web page file in real time according to the user request, thereby obviously simplifying the flow of the web page acquisition method and shortening the response time.
Fig. 13 shows a schematic structural diagram of a server according to an embodiment of the present application. The server may be a storage server in the above embodiments, or other servers, in particular:
The server 1200 includes a Central Processing Unit (CPU) 1201, a system memory 1204 including a Random Access Memory (RAM) 1202 and a Read Only Memory (ROM) 1203, and a system bus 1205 connecting the system memory 1204 and the central processing unit 1201. The server 1200 also includes a basic input/output system (I/O system) 1206, which helps to transfer information between various devices within the computer, and a mass storage device 1207 for storing an operating system 1213, application programs 1214, and other program modules 1215.
The basic input/output system 1206 includes a display 1208 for displaying information and an input device 1209, such as a mouse, keyboard, etc., for user input of information. Wherein both the display 1208 and the input device 1209 are coupled to the central processing unit 1201 via an input-output controller 1210 coupled to a system bus 1205. The basic input/output system 1206 can also include an input/output controller 1210 for receiving and processing input from a number of other devices, such as a keyboard, mouse, or electronic stylus. Similarly, the input output controller 810 also provides output to a display screen, a printer, or other type of output device.
The mass storage device 1207 is connected to the central processing unit 1201 through a mass storage controller (not shown) connected to the system bus 1205. Mass storage device 1207 and its associated computer-readable media provide non-volatile storage for server 1200. That is, mass storage device 1207 may include a computer readable medium (not shown), such as a hard disk or CD-ROM drive.
Computer readable media may include computer storage media and communication media without loss of generality. Computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Computer storage media includes RAM, ROM, EPROM, EEPROM, flash memory or other solid state memory technology, CD-ROM, DVD or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices. Of course, those skilled in the art will recognize that computer storage media are not limited to the ones described above. The system memory 1204 and mass storage device 1207 described above may be collectively referred to as memory.
According to various embodiments of the present application, the server 1200 may also operate by being connected to a remote computer on a network, such as the Internet. That is, the server 1200 may be connected to the network 1212 through a network interface unit 1211 coupled to the system bus 1205, or alternatively, the network interface unit 1211 may be used to connect to other types of networks or remote computer systems (not shown).
The memory also includes one or more programs, one or more programs stored in the memory and configured to be executed by the CPU.
Fig. 14 shows a block diagram of a terminal 1300 according to an exemplary embodiment of the present application. The server may be a user terminal in the above embodiment. The terminal 1300 may be a portable mobile terminal such as: a smart phone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III, motion picture expert compression standard audio plane 3), an MP4 (Moving Picture Experts Group Audio Layer IV, motion picture expert compression standard audio plane 4) player, a notebook computer, or a desktop computer. Terminal 1300 may also be referred to by other names of user terminals, portable terminals, laptop terminals, desktop terminals, etc.
In general, the terminal 1300 includes: a processor 1301, and a memory 1302.
Processor 1301 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and the like. Processor 1301 may be implemented in hardware in at least one of a DSP (Digital Signal Processing ), FPGA (Field-Programmable Gate Array, field programmable gate array) or PLA (Programmable Logic Array ). Processor 1301 may also include a main processor, which is a processor for processing data in an awake state, also called a CPU (Central Processing Unit ), and a coprocessor; a coprocessor is a low-power processor for processing data in a standby state. In some embodiments, processor 1301 may integrate a GPU (Graphics Processing Unit, image processor) for rendering and rendering of content required to be displayed by the display screen. In some embodiments, the processor 1301 may also include an AI (Artificial Intelligence ) processor for processing computing operations related to machine learning.
Memory 1302 may include one or more computer-readable storage media, which may be non-transitory. Memory 1302 may also include high-speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In some embodiments, a non-transitory computer readable storage medium in memory 1302 is used to store at least one instruction for execution by processor 1301 to implement the web page retrieval method provided by the method embodiments herein.
In some embodiments, the terminal 1300 may further optionally include: a peripheral interface 1303 and at least one peripheral. The processor 1301, the memory 1302, and the peripheral interface 1303 may be connected by a bus or signal lines. The respective peripheral devices may be connected to the peripheral device interface 1303 through a bus, a signal line, or a circuit board. Specifically, the peripheral device includes: at least one of radio frequency circuitry 1304, touch display screen 1305, camera 1306, audio circuitry 1307, positioning components 1308, or power supply 1309.
A peripheral interface 1303 may be used to connect I/O (Input/Output) related at least one peripheral to the processor 1301 and the memory 1302. In some embodiments, processor 1301, memory 1302, and peripheral interface 1303 are integrated on the same chip or circuit board; in some other embodiments, either or both of the processor 1301, the memory 1302, and the peripheral interface 1303 may be implemented on separate chips or circuit boards, which is not limited in this embodiment.
The Radio Frequency circuit 1304 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 1304 communicates with a communication network and other communication devices via electromagnetic signals. The radio frequency circuit 1304 converts an electrical signal to an electromagnetic signal for transmission, or converts a received electromagnetic signal to an electrical signal. Optionally, the radio frequency circuit 1304 includes: antenna systems, RF transceivers, one or more amplifiers, tuners, oscillators, digital signal processors, codec chipsets, subscriber identity module cards, and so forth. The radio frequency circuit 1304 may communicate with other terminals via at least one wireless communication protocol. The wireless communication protocol includes, but is not limited to: the world wide web, metropolitan area networks, intranets, generation mobile communication networks (2G, 3G, 4G, and 5G), wireless local area networks, and/or WiFi (Wireless Fidelity ) networks. In some embodiments, the radio frequency circuit 1304 may also include NFC (Near Field Communication ) related circuits, which are not limited in this application.
The display screen 1305 is used to display a UI (User Interface). The UI may include graphics, text, icons, video, and any combination thereof. When the display 1305 is a touch display, the display 1305 also has the ability to capture touch signals at or above the surface of the display 1305. The touch signal may be input to the processor 1301 as a control signal for processing. At this point, the display 1305 may also be used to provide virtual buttons and/or a virtual keyboard, also referred to as soft buttons and/or a soft keyboard. In some embodiments, the display screen 1305 may be one, providing the front panel of the terminal 1300; in other embodiments, the display 1305 may be at least two, disposed on different surfaces of the terminal 1300 or in a folded configuration; in still other embodiments, the display 1305 may be a flexible display disposed on a curved surface or a folded surface of the terminal 1300. Even more, the display screen 1305 may be arranged in a non-rectangular irregular pattern, i.e., a shaped screen. The display screen 1305 may be made of LCD (Liquid Crystal Display ), OLED (Organic Light-Emitting Diode) or other materials.
The camera assembly 1306 is used to capture images or video. Optionally, camera assembly 1306 includes a front camera and a rear camera. Typically, the front camera is disposed on the front panel of the terminal and the rear camera is disposed on the rear surface of the terminal. In some embodiments, the at least two rear cameras are any one of a main camera, a depth camera, a wide-angle camera and a tele camera, so as to realize that the main camera and the depth camera are fused to realize a background blurring function, and the main camera and the wide-angle camera are fused to realize a panoramic shooting and Virtual Reality (VR) shooting function or other fusion shooting functions. In some embodiments, camera assembly 1306 may also include a flash. The flash lamp can be a single-color temperature flash lamp or a double-color temperature flash lamp. The dual-color temperature flash lamp refers to a combination of a warm light flash lamp and a cold light flash lamp, and can be used for light compensation under different color temperatures.
The audio circuit 1307 may include a microphone and a speaker. The microphone is used for collecting sound waves of users and environments, converting the sound waves into electric signals, and inputting the electric signals to the processor 1301 for processing, or inputting the electric signals to the radio frequency circuit 1304 for voice communication. For purposes of stereo acquisition or noise reduction, a plurality of microphones may be provided at different portions of the terminal 1300, respectively. The microphone may also be an array microphone or an omni-directional pickup microphone. The speaker is then used to convert electrical signals from the processor 1301 or the radio frequency circuit 1304 into sound waves. The speaker may be a conventional thin film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, not only the electric signal can be converted into a sound wave audible to humans, but also the electric signal can be converted into a sound wave inaudible to humans for ranging and other purposes. In some embodiments, the audio circuit 1307 may also comprise a headphone jack.
The location component 1308 is used to locate the current geographic location of the terminal 1300 to enable navigation or LBS (Location Based Service, location-based services). The positioning component 1308 may be a positioning component based on the United states GPS (Global Positioning System ), the Beidou system of China, or the Galileo system of Russia.
A power supply 1309 is used to power the various components in the terminal 1300. The power supply 1309 may be an alternating current, a direct current, a disposable battery, or a rechargeable battery. When the power supply 1309 comprises a rechargeable battery, the rechargeable battery may be a wired rechargeable battery or a wireless rechargeable battery. The wired rechargeable battery is a battery charged through a wired line, and the wireless rechargeable battery is a battery charged through a wireless coil. The rechargeable battery may also be used to support fast charge technology.
In some embodiments, terminal 1300 also includes one or more sensors 1310. The one or more sensors 1310 include, but are not limited to: acceleration sensor 1311, gyroscope sensor 912, pressure sensor 1313, fingerprint sensor 1314, optical sensor 1315, and proximity sensor 1316.
The acceleration sensor 1311 can detect the magnitudes of accelerations on three coordinate axes of the coordinate system established with the terminal 1300. For example, the acceleration sensor 1311 may be used to detect components of gravitational acceleration in three coordinate axes. Processor 1301 may control touch display screen 1305 to display a user interface in either a landscape view or a portrait view based on gravitational acceleration signals acquired by acceleration sensor 1311. The acceleration sensor 1311 may also be used for the acquisition of motion data of a game or user.
The gyro sensor 1312 may detect a body direction and a rotation angle of the terminal 1300, and the gyro sensor 1312 may collect a 3D motion of the user on the terminal 1300 in cooperation with the acceleration sensor 1311. The processor 901 may implement the following functions according to the data collected by the gyro sensor 1312: motion sensing (e.g., changing UI according to a tilting operation by a user), image stabilization at shooting, game control, and inertial navigation.
Pressure sensor 1313 may be disposed on a side frame of terminal 1300 and/or below touch display 905. When the pressure sensor 1313 is disposed at a side frame of the terminal 1300, a grip signal of the user to the terminal 900 may be detected, and the processor 1301 performs left-right hand recognition or shortcut operation according to the grip signal collected by the pressure sensor 1313. When the pressure sensor 1313 is disposed at the lower layer of the touch display screen 1305, the processor 1301 realizes control of the operability control on the UI interface according to the pressure operation of the user on the touch display screen 1305. The operability controls include at least one of a button control, a scroll bar control, an icon control, or a menu control.
The fingerprint sensor 1314 is used to collect a fingerprint of the user, and the processor 1301 identifies the identity of the user based on the fingerprint collected by the fingerprint sensor 1314, or the fingerprint sensor 1314 identifies the identity of the user based on the collected fingerprint. Upon recognizing that the user's identity is a trusted identity, the user is authorized by processor 1301 to perform relevant sensitive operations including unlocking the screen, viewing encrypted information, downloading software, paying for and changing settings, etc. The fingerprint sensor 1314 may be disposed on the front, back, or side of the terminal 1300. When a physical key or vendor Logo is provided on the terminal 1300, the fingerprint sensor 1314 may be integrated with the physical key or vendor Logo.
The optical sensor 1315 is used to collect ambient light intensity. In one embodiment, processor 1301 may control the display brightness of touch display screen 1305 based on the intensity of ambient light collected by optical sensor 1315. Specifically, when the ambient light intensity is high, the display brightness of the touch display screen 1305 is turned up; when the ambient light intensity is low, the display brightness of the touch display screen 1305 is turned down. In another embodiment, processor 1301 may also dynamically adjust the shooting parameters of camera assembly 1306 based on the intensity of ambient light collected by optical sensor 1315.
A proximity sensor 1316, also referred to as a distance sensor, is typically provided on the front panel of the terminal 1300. The proximity sensor 1316 is used to collect the distance between the user and the front of the terminal 1300. In one embodiment, when proximity sensor 1316 detects a gradual decrease in the distance between the user and the front of terminal 1300, processor 1301 controls touch display 1305 to switch from a bright screen state to a inactive screen state; when the proximity sensor 1316 detects that the distance between the user and the front surface of the terminal 1300 gradually increases, the touch display screen 1305 is controlled by the processor 1301 to switch from the off-screen state to the on-screen state.
Those skilled in the art will appreciate that the structure shown in fig. 14 is not limiting of terminal 1300 and may include more or fewer components than shown, or may combine certain components, or may employ a different arrangement of components.
In an exemplary embodiment, a computer readable storage medium, such as a memory including instructions executable by a processor in a terminal to perform the web page retrieval method of the above embodiment is also provided. For example, the computer readable storage medium may be Read-Only Memory (ROM), random-access Memory (Random Access Memory, RAM), compact disc Read-Only Memory (CD-ROM), magnetic tape, floppy disk, optical data storage device, and the like.
The foregoing description of the preferred embodiments of the present invention is not intended to limit the invention, but rather, the invention is to be construed as limited to the appended claims.
Claims (7)
1. A method for acquiring a web page, wherein the method is applied to a background device, and the method comprises:
counting at least one webpage with highest access frequency of the user;
Acquiring data of at least one webpage, wherein the data of the webpage are stored in a JSON file format;
generating at least one webpage file by prerendering a JSON file of the webpage based on the hook function in the webpage source code stored by the background equipment according to the data of the at least one webpage and a webpage template, wherein the webpage template is generated based on a Document Object Model (DOM) tree, and comprises at least one webpage sub-template, and each webpage sub-template is used for generating a style of webpage file;
storing the at least one webpage file to a storage server, wherein the storage server is used for providing the webpage file corresponding to the user request in the at least one webpage file for the user terminal according to the user request of the user terminal;
the method further comprises the steps of:
when the data of a target webpage in at least one webpage is detected to be updated, determining at least one webpage file associated with the data of the target webpage, correspondingly generating an updated JSON file, and acquiring the target webpage and a webpage template corresponding to the associated at least one webpage file;
calling a hook function in page source codes for the target webpage and the associated at least one webpage file, and generating a corresponding updated webpage file according to the updated JSON file and the corresponding webpage template;
Storing the updated webpage file into the storage server, wherein the storage server is used for updating the webpage file of the target webpage and the associated at least one webpage file into the updated webpage file;
the process of providing the web page file corresponding to the user request in the at least one web page file to the user terminal by the storage server according to the user request of the user terminal comprises the following steps:
and receiving the user request through a nginx, and obtaining a webpage file corresponding to the user request generated in the storage server through forwarding, wherein the forwarding process refers to a process of mapping a URL in the user request and a storage path of the webpage file in the storage server, and the nginx is a proxy server.
2. A method for acquiring a web page, wherein the method is applied to a storage server, and the method comprises:
receiving and storing at least one webpage file provided by the background equipment, wherein the at least one webpage file corresponds to at least one webpage, the at least one webpage is at least one webpage with highest user access frequency obtained by the background equipment, and the generation process of the webpage file comprises the following steps: acquiring data of at least one webpage, wherein the data of the webpage are stored in a JSON file format; generating at least one webpage file by prerendering a JSON file of the webpage based on the hook function in the webpage source code stored by the background equipment according to the data of the at least one webpage and a webpage template, wherein the webpage template is generated based on a Document Object Model (DOM) tree, and comprises at least one webpage sub-template, and each webpage sub-template is used for generating a style of webpage file;
Acquiring a user request of a user terminal;
according to the user request, searching whether the at least one webpage file exists in the webpage file corresponding to the user request comprises the following steps: receiving the user request through a nginx, and obtaining a webpage file corresponding to the user request generated in the storage server through forwarding, wherein the forwarding process refers to a process of mapping a URL in the user request and a storage path of the webpage file in the storage server, and the nginx is a proxy server;
when the webpage file corresponding to the user request exists, sending the webpage file corresponding to the user request to the user terminal;
the method further comprises the steps of:
when receiving an updated webpage file corresponding to a target webpage and at least one webpage file associated with the target webpage in at least one webpage transmitted by the background equipment, updating the webpage file of the target webpage and the associated at least one webpage file into the updated webpage file;
the generation process of the updated webpage file comprises the following steps:
when the data of a target webpage in at least one webpage is detected to be updated, the background equipment determines at least one webpage file associated with the data of the target webpage, correspondingly generates an updated JSON file, and acquires the target webpage and a webpage template corresponding to the associated at least one webpage file;
And calling a hook function in page source codes for the target webpage and the associated at least one webpage file, and generating a corresponding updated webpage file according to the updated JSON file and the corresponding webpage template.
3. A method for acquiring a web page, wherein the method is applied to a user terminal, and the method comprises the following steps:
acquiring operation information of a user;
determining a user request according to the operation information, wherein the user request is used for indicating a webpage address;
the user request is sent to a storage server, at least one webpage file is stored in the storage server, the at least one webpage file corresponds to at least one webpage, and the at least one webpage is at least one webpage with highest user access frequency obtained through statistics of background equipment;
receiving a webpage file corresponding to the user request fed back by the storage server, wherein the process of acquiring the webpage file corresponding to the user request by the storage server comprises the following steps: receiving the user request through a nginx, and obtaining a webpage file corresponding to the user request generated in the storage server through forwarding, wherein the forwarding process refers to a process of mapping a URL in the user request and a storage path of the webpage file in the storage server, and the nginx is a proxy server;
The generation process of the webpage file comprises the following steps: acquiring data of at least one webpage, wherein the data of the webpage are stored in a JSON file format; generating at least one webpage file by prerendering a JSON file of the webpage based on the hook function in the webpage source code stored by the background equipment according to the data of the at least one webpage and a webpage template, wherein the webpage template is generated based on a Document Object Model (DOM) tree, and comprises at least one webpage sub-template, and each webpage sub-template is used for generating a style of webpage file;
when receiving an update webpage file corresponding to a target webpage and at least one webpage file associated with the target webpage in at least one webpage sent by background equipment, the storage server updates the webpage file of the target webpage and the associated at least one webpage file into the update webpage file;
the generation process of the updated webpage file comprises the following steps:
when the data of a target webpage in at least one webpage is detected to be updated, the background equipment determines at least one webpage file associated with the data of the target webpage, correspondingly generates an updated JSON file, and acquires the target webpage and a webpage template corresponding to the associated at least one webpage file;
And calling a hook function in page source codes for the target webpage and the associated at least one webpage file, and generating a corresponding updated webpage file according to the updated JSON file and the corresponding webpage template.
4. A web page acquisition apparatus, the apparatus being applied to a background device, the apparatus comprising:
the first acquisition module is used for counting at least one webpage with highest access frequency of a user, acquiring data of the at least one webpage, and storing the data of the webpage in a JSON file format;
the generation module is used for generating at least one webpage file by prerendering a JSON file of the webpage based on the hook function in the page source code stored by the background equipment according to the data of the at least one webpage and a webpage template, wherein the webpage template is generated based on a Document Object Model (DOM) tree, and comprises at least one webpage sub-template, and each webpage sub-template is used for generating a webpage file of a style;
the storage module is used for storing the at least one webpage file to a storage server, and the storage server is used for providing the webpage file corresponding to the user request in the at least one webpage file for the user terminal according to the user request of the user terminal;
The acquisition module is further used for determining at least one webpage file associated with the data of the target webpage when the data of the target webpage in the at least one webpage is detected to be updated, correspondingly generating an updated JSON file, and acquiring the target webpage and a webpage template corresponding to the associated at least one webpage file;
the generation module is further configured to call a hook function in a page source code for the target webpage and the associated at least one webpage file, and generate a corresponding updated webpage file according to the updated JSON file and the corresponding webpage template;
the storage module is further configured to store the updated web page file to the storage server, where the storage server is configured to update the web page file of the target web page and the associated at least one web page file to the updated web page file;
the process of providing the web page file corresponding to the user request in the at least one web page file to the user terminal by the storage server according to the user request of the user terminal comprises the following steps:
and receiving the user request through a nginx, and obtaining a webpage file corresponding to the user request generated in the storage server through forwarding, wherein the forwarding process refers to a process of mapping a URL in the user request and a storage path of the webpage file in the storage server, and the nginx is a proxy server.
5. A web page acquisition device, the device being applied to a storage server, the device comprising:
the first receiving module is configured to receive and store at least one web page file provided by the background device, where the at least one web page file corresponds to at least one web page, and the at least one web page is at least one web page with the highest user access frequency obtained by statistics of the background device, where the generating process of the web page file includes: acquiring data of at least one webpage, wherein the data of the webpage are stored in a JSON file format; generating at least one webpage file by prerendering a JSON file of the webpage based on the hook function in the webpage source code stored by the background equipment according to the data of the at least one webpage and a webpage template, wherein the webpage template is generated based on a Document Object Model (DOM) tree, and comprises at least one webpage sub-template, and each webpage sub-template is used for generating a style of webpage file;
the second acquisition module is used for acquiring a user request of the user terminal;
the searching module is configured to search whether a web page file corresponding to the user request exists in the at least one web page file according to the user request, and includes: receiving the user request through a nginx, and obtaining a webpage file corresponding to the user request generated in the storage server through forwarding, wherein the forwarding process refers to a process of mapping a URL in the user request and a storage path of the webpage file in the storage server, and the nginx is a proxy server;
The first sending module is used for sending the webpage file corresponding to the user request to the user terminal when the webpage file corresponding to the user request exists;
the first receiving module is further configured to update, when receiving an update web page file corresponding to a target web page and at least one web page file associated with the target web page in at least one web page sent by the background device, the web page file of the target web page and the associated at least one web page file into the update web page file;
the generation process of the updated webpage file comprises the following steps:
when the data of a target webpage in at least one webpage is detected to be updated, the background equipment determines at least one webpage file associated with the data of the target webpage, correspondingly generates an updated JSON file, and acquires the target webpage and a webpage template corresponding to the associated at least one webpage file;
and calling a hook function in page source codes for the target webpage and the associated at least one webpage file, and generating a corresponding updated webpage file according to the updated JSON file and the corresponding webpage template.
6. A web page acquisition device, wherein the device is applied to a user terminal, the device comprising:
the third acquisition module is used for acquiring the operation information of the user;
the determining module is used for determining a user request according to the operation information, wherein the user request is used for indicating a webpage address;
the second sending module is used for sending the user request to a storage server, wherein the storage server stores at least one webpage file, the at least one webpage file corresponds to at least one webpage, and the at least one webpage is at least one webpage with highest user access frequency obtained through background equipment statistics;
the second receiving module is configured to receive a web page file corresponding to the user request, where the process of obtaining, by the storage server, the web page file corresponding to the user request includes: receiving the user request through a nginx, and obtaining a webpage file corresponding to the user request generated in the storage server through forwarding, wherein the forwarding process refers to a process of mapping a URL in the user request and a storage path of the webpage file in the storage server, and the nginx is a proxy server;
The generation process of the webpage file comprises the following steps: acquiring data of at least one webpage, wherein the data of the webpage are stored in a JSON file format; generating at least one webpage file by prerendering a JSON file of the webpage based on the hook function in the webpage source code stored by the background equipment according to the data of the at least one webpage and a webpage template, wherein the webpage template is generated based on a Document Object Model (DOM) tree, and comprises at least one webpage sub-template, and each webpage sub-template is used for generating a style of webpage file;
when receiving an update webpage file corresponding to a target webpage and at least one webpage file associated with the target webpage in at least one webpage sent by background equipment, the storage server updates the webpage file of the target webpage and the associated at least one webpage file into the update webpage file;
the generation process of the updated webpage file comprises the following steps:
when the data of a target webpage in at least one webpage is detected to be updated, the background equipment determines at least one webpage file associated with the data of the target webpage, correspondingly generates an updated JSON file, and acquires the target webpage and a webpage template corresponding to the associated at least one webpage file;
And calling a hook function in page source codes for the target webpage and the associated at least one webpage file, and generating a corresponding updated webpage file according to the updated JSON file and the corresponding webpage template.
7. A web page acquisition system, the system comprising: background equipment, a storage server and a user terminal;
the background device comprises the web page acquisition device of claim 4, the storage server comprises the web page acquisition device of claim 5, and the user terminal comprises the web page acquisition device of claim 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910703588.XA CN110390065B (en) | 2019-07-31 | 2019-07-31 | Webpage acquisition method, device and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910703588.XA CN110390065B (en) | 2019-07-31 | 2019-07-31 | Webpage acquisition method, device and system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110390065A CN110390065A (en) | 2019-10-29 |
CN110390065B true CN110390065B (en) | 2024-02-06 |
Family
ID=68287974
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910703588.XA Active CN110390065B (en) | 2019-07-31 | 2019-07-31 | Webpage acquisition method, device and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110390065B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112394971A (en) * | 2020-11-20 | 2021-02-23 | 广州橙行智动汽车科技有限公司 | Data processing method and device |
Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101459571A (en) * | 2008-12-16 | 2009-06-17 | 北京大学 | Method, system and apparatus for website mirroring |
CN102456035A (en) * | 2010-10-28 | 2012-05-16 | 金蝶软件(中国)有限公司 | Webpage resource cache control method, device and system |
US9253013B1 (en) * | 2012-07-31 | 2016-02-02 | Instart Logic, Inc. | Efficient delivery of content by virtualization of dynamic interaction with the document object model |
CN105373615A (en) * | 2015-11-24 | 2016-03-02 | 深圳市华讯方舟科技有限公司 | Page customization method and device |
CN105956152A (en) * | 2016-05-13 | 2016-09-21 | 北京金山安全软件有限公司 | Webpage loading method and device and electronic equipment |
CN106897336A (en) * | 2016-06-28 | 2017-06-27 | 阿里巴巴集团控股有限公司 | Web page files sending method, webpage rendering intent and device, webpage rendering system |
CN106933890A (en) * | 2015-12-31 | 2017-07-07 | 华为技术有限公司 | A kind of processing method and processing device of static page |
CN107590397A (en) * | 2017-09-19 | 2018-01-16 | 广州酷狗计算机科技有限公司 | A kind of method and apparatus for showing embedded webpage |
CN108241703A (en) * | 2016-12-27 | 2018-07-03 | 腾讯科技(深圳)有限公司 | Web data transmission method and device |
CN108616552A (en) * | 2016-12-13 | 2018-10-02 | 腾讯科技(深圳)有限公司 | Web access method, device and system |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10102306B2 (en) * | 2016-05-03 | 2018-10-16 | International Business Machines Corporation | Patching base document object model (DOM) with DOM-differentials to generate high fidelity replay of webpage user interactions |
US20180032491A1 (en) * | 2016-07-26 | 2018-02-01 | Google Inc. | Web page display systems and methods |
-
2019
- 2019-07-31 CN CN201910703588.XA patent/CN110390065B/en active Active
Patent Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101459571A (en) * | 2008-12-16 | 2009-06-17 | 北京大学 | Method, system and apparatus for website mirroring |
CN102456035A (en) * | 2010-10-28 | 2012-05-16 | 金蝶软件(中国)有限公司 | Webpage resource cache control method, device and system |
US9253013B1 (en) * | 2012-07-31 | 2016-02-02 | Instart Logic, Inc. | Efficient delivery of content by virtualization of dynamic interaction with the document object model |
CN105373615A (en) * | 2015-11-24 | 2016-03-02 | 深圳市华讯方舟科技有限公司 | Page customization method and device |
CN106933890A (en) * | 2015-12-31 | 2017-07-07 | 华为技术有限公司 | A kind of processing method and processing device of static page |
CN105956152A (en) * | 2016-05-13 | 2016-09-21 | 北京金山安全软件有限公司 | Webpage loading method and device and electronic equipment |
CN106897336A (en) * | 2016-06-28 | 2017-06-27 | 阿里巴巴集团控股有限公司 | Web page files sending method, webpage rendering intent and device, webpage rendering system |
CN108616552A (en) * | 2016-12-13 | 2018-10-02 | 腾讯科技(深圳)有限公司 | Web access method, device and system |
CN108241703A (en) * | 2016-12-27 | 2018-07-03 | 腾讯科技(深圳)有限公司 | Web data transmission method and device |
CN107590397A (en) * | 2017-09-19 | 2018-01-16 | 广州酷狗计算机科技有限公司 | A kind of method and apparatus for showing embedded webpage |
Non-Patent Citations (1)
Title |
---|
李锡辉等.ASP.NET程序设计案例教程.西安电子科技大学出版社,2010,第181-182页. * |
Also Published As
Publication number | Publication date |
---|---|
CN110390065A (en) | 2019-10-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110674022B (en) | Behavior data acquisition method and device and storage medium | |
CN107885533B (en) | Method and device for managing component codes | |
CN110110263B (en) | Webpage display method, device, terminal and storage medium | |
CN110413501B (en) | Browser compatibility testing method, device and system and readable storage medium | |
CN109948087B (en) | Webpage resource obtaining method and device and terminal | |
CN111159604A (en) | Picture resource loading method and device | |
CN113051015B (en) | Page rendering method and device, electronic equipment and storage medium | |
CN109040339B (en) | Cross-domain request processing method, device and equipment based on AJAX | |
CN112257006B (en) | Page information configuration method, device, equipment and computer readable storage medium | |
CN108038232B (en) | Webpage editing method, device and system and storage medium | |
CN109917988B (en) | Selected content display method, device, terminal and computer readable storage medium | |
CN111625315A (en) | Page display method and device, electronic equipment and storage medium | |
CN110515962B (en) | Method and device for caching data, electronic equipment and storage medium | |
CN111241451A (en) | Webpage processing method and device, computer equipment and storage medium | |
CN113204302B (en) | Virtual robot-based operation method, device, equipment and storage medium | |
CN110390065B (en) | Webpage acquisition method, device and system | |
CN111008083B (en) | Page communication method and device, electronic equipment and storage medium | |
CN112052419A (en) | Picture loading method, device and equipment and readable storage medium | |
CN111275607A (en) | Interface display method and device, computer equipment and storage medium | |
CN112181442A (en) | Unloaded page display method, device, terminal, server and storage medium | |
CN110569064A (en) | interface identifier generation method, device, equipment and storage medium | |
CN112596810B (en) | Loading prompt information display method and device, electronic equipment and storage medium | |
CN114816600B (en) | Session message display method, device, terminal and storage medium | |
CN112597417B (en) | Page updating method and device, electronic equipment and storage medium | |
CN116418771A (en) | Message display method, message processing method, device and electronic equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |