CN110633432A - Method, device, terminal equipment and medium for acquiring data - Google Patents
Method, device, terminal equipment and medium for acquiring data Download PDFInfo
- Publication number
- CN110633432A CN110633432A CN201910762509.2A CN201910762509A CN110633432A CN 110633432 A CN110633432 A CN 110633432A CN 201910762509 A CN201910762509 A CN 201910762509A CN 110633432 A CN110633432 A CN 110633432A
- Authority
- CN
- China
- Prior art keywords
- target
- cookie value
- data
- host application
- target webpage
- 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.)
- Pending
Links
Images
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/955—Retrieval from the web using information identifiers, e.g. uniform resource locators [URL]
- G06F16/9566—URL specific, e.g. using aliases, detecting broken or misspelled links
-
- 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/9577—Optimising the visualization of content, e.g. distillation of HTML documents
Abstract
The application is applicable to the technical field of Internet, and provides a method, a device, terminal equipment and a medium for acquiring data, a method for acquiring data, loading a target web page through a page access window created in a host application, obtaining a first cookie value from a local database of the host application, and identifies the first cookie value as a target cookie value for the target web page, since the first cookie value is a persistent cookie value, when a data acquisition request is transmitted to the server through the target web page, the server can determine the access authority according to the target cookie value carried in the data acquisition request, and then return the target data to the target webpage, when obtaining the target data again through the target webpage, need not manual retrying account number and password and log on and can obtain the target data, simplified the operation of obtaining of target data, improved the automation level of obtaining the target data repeatedly.
Description
Technical Field
The present application belongs to the field of internet technologies, and in particular, to a method for acquiring data, a device for acquiring data, a terminal device, and a computer-readable storage medium.
Background
With the increasing popularity of mobile terminals, more and more applications can be run on the terminals. The existing application programs are mainly divided into Native-APP (application), cross-platform Web-APP (Web-APP) and Hybrid-APP, wherein the Hybrid application is an application between the Native application and the cross-platform application, and has the advantages of good interaction experience of the Native application and cross-platform development of the cross-platform application, so that more and more Hybrid applications are applied in the application market. The existing hybrid application can create a page access window through a web page container tool, such as a web-view component, and acquire and load a corresponding hypertext markup language (HTML) 5 file through the page access window to obtain a target web page, thereby realizing cross-platform data access in the form of the web page.
However, for some target web pages that require account login to access specific data, when the user repeatedly accesses the target web pages, the previous login status of the user cannot be recorded. Therefore, when the user accesses the specific data through the target webpage in the hybrid application again, the user needs to manually input the account and the password again for logging in, and therefore the existing data acquisition mode has the problem that the operation process is complicated.
Disclosure of Invention
In view of this, embodiments of the present application provide a method, an apparatus, a terminal device, and a computer-readable storage medium for acquiring data, so as to solve the problem that an operation process is complicated in an existing data acquisition manner.
A first aspect of an embodiment of the present application provides a method for acquiring data, including:
acquiring and loading a target webpage file through a page access window established in a host application program to obtain a target webpage;
if a preset instruction for acquiring target data through the target webpage is detected, acquiring a first cookie value from a local database of the host application program;
identifying the first cookie value as a target cookie value of the target webpage, and sending a data acquisition request carrying the target cookie value to a server through the target webpage; and the server is used for returning the target data to the target webpage according to the cookie value.
Further, before the step of acquiring the first cookie value from the local database of the host application program if the preset instruction for acquiring the target data through the target web page is detected, the method further includes:
receiving account information input by a user through the target webpage, and sending a login request to a server according to the account information so as to receive a first cookie value returned by the server;
storing the first cookie value in a local database of the host application.
Further, the storing the first cookie value in a local database of the host application includes:
determining a file directory of the target webpage from a local database of the host application program according to the first cookie value;
storing the first cookie value in the file directory.
Further, the obtaining and loading the target webpage file through the page access window created in the host application to obtain the target webpage includes:
if the preset operation of loading the target webpage file is monitored through the host application program, calling a preset web-view component in the host application program to create a page access window;
and loading a hypertext markup language (HMTL) file pointed by a Uniform Resource Locator (URL) in a web-view label through the page access window to obtain the target webpage.
Further, if the preset instruction for acquiring the target data through the target webpage is detected, acquiring a first cookie value from a local database of the host application program includes:
if a preset instruction for acquiring target data through the target webpage is detected, searching a file directory corresponding to the target webpage from a local database of the host application program;
extracting the first cookie value from the file directory.
Further, the identifying the first cookie value as the target cookie value of the target web page and sending the data acquisition request carrying the target cookie value to the server through the target web page includes:
configuring the first cookie value into the URL to obtain a new URL;
and identifying the first cookie value as a target cookie value through the target webpage according to the new URL, and sending a data acquisition request carrying the target cookie value to a server.
Further, the configuring the first cookie value to the URL to obtain a new URL includes:
and configuring the first cookie value into the URL through the web-view component in an address bar parameter transmission mode to obtain a new URL.
A second aspect of an embodiment of the present application provides an apparatus for acquiring data, including:
the loading unit is used for acquiring and loading a target webpage file through a page access window established in the host application program to obtain a target webpage;
a first obtaining unit, configured to obtain a first cookie value from a local database of the host application if a preset instruction for obtaining target data through the target web page is detected;
the execution unit is used for identifying the first cookie value as a target cookie value of the target webpage and sending a data acquisition request carrying the target cookie value to a server through the target webpage; and the server is used for returning the target data to the target webpage according to the cookie value.
A third aspect of the embodiments of the present application provides a terminal device, which includes a memory, a processor, and a computer program stored in the memory and operable on the terminal device, where the processor implements the steps of the method for acquiring data provided by the first aspect when executing the computer program.
A fourth aspect of embodiments of the present application provides a computer-readable storage medium storing a computer program which, when executed by a processor, implements the steps of the method for acquiring data provided by the first aspect.
A fifth aspect of embodiments of the present application provides a computer program product, which, when run on a terminal device, causes the terminal device to perform the steps of the method for acquiring data according to any one of the first aspect.
The method for acquiring data, the device for acquiring data, the terminal device and the computer readable storage medium provided by the embodiment of the application have the following beneficial effects that:
the method for acquiring data provided by the embodiment of the application loads a target webpage through a page access window created in a host application program, acquires a first cookie value from a local database of the host application program when a preset instruction for acquiring target data through the target webpage is detected, and identifies the first cookie value as a target cookie value of the target webpage, because the first cookie value is a persistent cookie value, when a data acquisition request is sent to a server through the target webpage, the server can determine the authority of the access according to the target cookie value carried in the data acquisition request so as to return the target data to the target webpage, when a user accesses the target data through the target webpage in hybrid application again, the user can acquire the target data without manually re-inputting an account number and a password for logging in, thereby simplifying the acquisition operation of the target data, the automation level of repeatedly acquiring the target data is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
Fig. 1 is a flowchart of an implementation of a method for acquiring data according to an embodiment of the present disclosure;
FIG. 2 is a flowchart illustrating an implementation of a method for obtaining data according to another embodiment of the present disclosure;
fig. 3 is a block diagram of an apparatus for acquiring data according to an embodiment of the present disclosure;
fig. 4 is a block diagram of a terminal device according to another embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
Referring to fig. 1, fig. 1 is a flowchart illustrating an implementation of a method for acquiring data according to an embodiment of the present disclosure. In this embodiment, an execution main body of the method for acquiring data is a terminal, and the terminal may be a computer used by a merchant or other existing terminal equipment, such as a tablet computer, a mobile phone, and the like.
The method of acquiring data as shown in fig. 1 comprises the steps of:
s11: and acquiring and loading a target webpage file through a page access window established in the host application program to obtain the target webpage.
In step S11, the host application is a hybrid application, and can access the cross-platform page by creating a page access window, that is, by creating a page access window as a web page container to access the web page data of other platforms. And the page access window is used for acquiring and loading the target webpage file according to the uniform resource locator URL. The target webpage file is obtained based on the file loading standard configuration of the page access window in the host application program and is used for representing the content of the target webpage.
It should be noted that the page access window is a page container that is hosted by the host application and is independent of the host application. In practice, not all applications are installed on the terminal, and when data to be acquired or data to be shared is content in a certain target application program, a target webpage file corresponding to the content may be acquired and loaded through a page access window created in a host application program, so as to display a target page corresponding to the content in the target application program. That is, the creation of the page access window needs to rely on the start of the host application program, and after the page access window acquires and loads the target webpage file, the obtained target webpage is independent from the host application program, that is, if the operation of the host application program is terminated, the target webpage is not affected.
It can be understood that the host application program may be configured to configure an access address corresponding to the target network file by opening a corresponding data transmission port, call the created page access window by the host application program to obtain the target web page file based on the access address, and then load the target web page in the page access window. The host application may be a social application, such as a forum, mailbox, WeChat, QQ, or microblog, among others.
Taking the case that the host application is a WeChat and the target webpage is any application home page not installed on the terminal, the target webpage file is obtained and loaded through a page access window created in the host application to obtain the target webpage, specifically, the target webpage file can be obtained and loaded through an applet page in the WeChat to obtain the target webpage for displaying the application home page not installed on the terminal.
In all embodiments of the present application, there is no permission limitation on the acquisition and loading of the target web page file, that is, as long as the page access window can acquire the address of the target web page file, the target web page file can be acquired through the network, and then the target web page file is loaded to obtain the target web page.
As a possible implementation manner of this embodiment, step S11 may include:
if the preset operation of loading the target webpage file is monitored through the host application program, calling a preset web-view component in the host application program to create a page access window; and loading a hypertext markup language (HMTL) file pointed by a Uniform Resource Locator (URL) in the web-view label through the page access window to obtain the target webpage.
In this embodiment, the page access window created by calling the web-view component is a container that can be used to carry web pages and is constructed by using the web-view component. And the URL in the web-view label is obtained by pre-configuring a service domain name according to the using mode of the web-view label.
Let URL be https:/www.example.comFor example, configuring the code field of the service domain name according to the use mode of the web-view tag is as follows:
<web-view src="https://www.example.com"></web-view>
it should be noted that the target web page file pointed by the URL is an HMTL file, the HMTL file can be loaded by calling a page access window created by the web-view component, and a page obtained by loading the HMTL file can be tiled in the entire page access window adaptively, so as to obtain the target web page.
S12: and if a preset instruction for acquiring target data through the target webpage is detected, acquiring a first cookie value from a local database of the host application program.
In step S12, the target data is data within the scope of authority, that is, the visitor is required to have corresponding access authority to acquire the target data. The first cookie value is a persistent cookie value and is also information returned by the server corresponding to the target data based on the historical access events, which is stored in the non-volatile memory of the terminal. The local database of the host application is used to store data generated by the host application during operation.
It should be noted that, when the host application is installed on the terminal, a local database corresponding to the host application is established, a corresponding data storage policy is configured in the local database, and based on the data storage policy, data generated by the host application in the running process can be regularly stored in the local database.
In all embodiments of the present application, the Cookie value refers to data stored on the user's local terminal by the web server for the purpose of identifying the user's identity and performing session control tracking.
It should be noted that the Cookie value is divided into a Session Cookie and a Persistent Cookie, namely, Session Cookies and Persistent Cookies, wherein the Session Cookie is a text file stored in a browser directory, and when a browser runs, the Cookie value represented by the text file is stored in the RAM to play a role; the persistent Cookie means that when the user logs out from a website or a server, that is, when the browser session is ended, the server transmits the created Cookie value back to the terminal and stores the Cookie value on a non-volatile memory of the terminal. In addition, the biggest difference between the session cookie and the persistent cookie is that the session cookie does not set expiration time, and when the page access window is closed and the target webpage is terminated to access, the session cookie is invalid; an expiration time is set in the persistent cookie so that the page access window will store the persistent cookie in the terminal's non-volatile memory, which will remain valid until the expiration time is exceeded.
The first Cookie value in this embodiment is a persistent Cookie that is returned by the server and stored on the terminal's non-volatile memory.
S13: identifying the first cookie value as a target cookie value of the target webpage, and sending a data acquisition request carrying the target cookie value to the server through the target webpage; and the server is used for returning the target data to the target webpage according to the target cookie value.
In step S13, the content represented by the target cookie value is the same as the content represented by the first cookie value, and the first cookie value is identified as the target cookie value of the target web page, where the target cookie value is assigned to the target cookie value of the target web page, and when the target data is obtained through the target web page, the target cookie value is carried in the data obtaining request, and the data obtaining request is sent to the server through the target web page.
In all embodiments of the present application, since the Cookie value refers to data stored on the local terminal of the user by the web server for identifying the user identity and performing session control tracking, the target Cookie value is carried in the data acquisition request, so that the server can identify the user identity according to the target Cookie value when receiving the data acquisition request, and then return the target data to the target webpage.
As a possible implementation manner of this embodiment, step S13 may include:
configuring the first cookie value into the URL to obtain a new URL; and identifying the first cookie value as a target cookie value through the target webpage according to the new URL, and sending a data acquisition request carrying the target cookie value to a server.
It should be noted that the URL includes: communication protocol, host, port number, path, query, and piece of information. The communication protocol comprises http, ftp, mail and the like; the host is a server domain name, a system (DNS) host name or an IP address and the like; the port number may be a defined number port or a default port, such as http with a default port of 80; a string of characters whose paths are separated by zero or more "/" symbols is typically used to indicate a directory or file address on the host. The query is used to deliver parameters to dynamic web pages (e.g., web pages made using CGI, ISAPI, PHP/JSP/ASP. net, etc.) and may have multiple parameters separated by the "&" symbol, with the name and value of each parameter separated by the "&" symbol. The information segments are strings used to specify segments in the network resource. For example, there are multiple noun interpretations in a web page, and fragment can be used to directly target a noun interpretation.
In this embodiment, the first cookie value is configured in the URL to obtain a new URL, and the content represented by the first cookie value is added to the URL.
As a possible implementation manner of this embodiment, the following steps are performed: configuring the first cookie value into the URL to obtain a new URL, which may include:
and configuring the first cookie value into the URL through the web-view component in an address bar parameter transmission mode to obtain a new URL.
In this embodiment, the web-view component configures the first cookie value into the URL in an address bar parameter transferring manner, that is, the content of the URL is changed, and the first cookie value is used as a parameter transferring object to modify the content of the URL to obtain a new URL.
Let URL be https:/www.example.comAnd the first cookie value is XY as an example, and the code field for configuring the service domain name according to the use mode of the web-view label is as follows:
<web-view src="https://www.example.com"></web-view>
configuring the first cookie value to the URL to obtain a new URL, wherein the code field corresponding to the new URL is as follows:
<web-view src="https://www.example.com/api?cookie=XY"></web-view>
as a possible implementation manner of this embodiment, the content of the first Cookie value at least includes: an authentication value KEY and a field name AUTHID.
In this embodiment, the target web page identifies the first cookie value as the target cookie value according to the new URL, and specifically, the verification value KEY and the field name AUTHID may be synchronized into the cookie of the HTML file of the target web page in a document.
It can be understood that, since the first cookie value is still stored in the terminal nonvolatile memory within the expiration time and remains valid, after the first cookie value is identified as the target cookie value, after the data acquisition request carrying the target cookie value is sent to the server through the target web page, when the server performs authority authentication on the user sending the data acquisition request according to the target cookie value carried in the data acquisition request, the authentication can be passed, and the target data can be returned to the target web page.
As can be seen from the above, in the method for acquiring data provided in this embodiment, a target web page is loaded through a page access window created in a host application program, when a preset instruction for acquiring target data through the target web page is detected, a first cookie value is acquired from a local database of the host application program, and the first cookie value is identified as a target cookie value of the target web page, because the first cookie value is a persistent cookie value, when a data acquisition request is sent to the server through the target web page, the server can determine the authority of this access according to the target cookie value carried in the data acquisition request, and further return the target data to the target web page, when a user accesses the target data through the target web page in the hybrid application again, the target data can be acquired without manually re-inputting an account and a password for login, thereby simplifying the operation of acquiring the target data, the automation level of repeatedly acquiring the target data is improved.
Referring to fig. 2, fig. 2 is a flowchart illustrating an implementation of a method for acquiring data according to another embodiment of the present application. With respect to the embodiment shown in fig. 1, the method for acquiring data provided in this embodiment further includes steps S21 to S22 before step S12. The details are as follows:
s21: and receiving account information input by a user through the target webpage, and sending a login request to a server according to the account information so as to receive a first cookie value returned by the server.
S22: storing the first cookie value in a local database of the host application.
In this embodiment, the account information is information of a login target webpage, and may specifically include an account number and a password. And the target webpage sends a login request to the server according to the account information, the server verifies the account information according to the login request and allows login, and meanwhile, a corresponding first cookie value is generated or created and returned to the terminal corresponding to the target webpage.
As a possible implementation manner of this embodiment, step S22 may include:
determining a file directory of the target webpage from a local database of the host application program according to the first cookie value; storing the first cookie value in the file directory.
It should be noted that the local database of the host application includes a text file corresponding to the page access window, where the text file includes information of the target web page accessed by the page access window, that is, a file directory of the target web page.
In this embodiment, the first cookie value is stored in the file directory, and when the terminal detects a preset instruction for acquiring the target data through the target web page, the terminal may acquire the first cookie value from the local database of the host application.
As a possible implementation manner of this embodiment, step S12 includes:
if the preset instruction for acquiring the target data through the target webpage is detected, searching a file directory corresponding to the target webpage from a local database of the host application program; extracting the first cookie value from the file directory.
In this embodiment, the local database includes a plurality of file directories, and since the host application can acquire and load the target web page file through the created page access window, a folder is separately created for the page access window, and the folder is used for storing data and information of the page accessed by the page access window. In a folder of the page access window, the file directory may be stored according to a domain name or an IP address of the target web page, and when a preset instruction for acquiring target data through the target web page is detected, the corresponding file directory may be searched from a local database of the host application program according to the domain name or the IP address of the target web page, that is, the first cookie value may be extracted from the file directory.
In the embodiment, a target webpage is loaded through a page access window created in a host application program, when a preset instruction for acquiring target data through the target webpage is detected, a first cookie value is acquired from a local database of the host application program and is identified as a target cookie value of the target webpage, because the first cookie value is information returned by a server corresponding to the target data based on a historical access event, when a data acquisition request is sent to the server through the target webpage, the server can determine the authority of the current access according to the target cookie value carried in the data acquisition request and further return the target data to the target webpage, when a user accesses the target data through the target webpage in the hybrid application again, the target data can be acquired without manually re-inputting an account number and a password for logging in, and the acquisition operation of the target data is simplified, the automation level of repeatedly acquiring the target data is improved.
In addition, the account information input by the user is received through the target webpage, the login request is sent to the server according to the account information so as to receive the first cookie value returned by the server, and meanwhile, the first cookie value is stored in the local database of the host application program, so that when the target data is accessed next time, the terminal can generate a data acquisition request with the permission of acquiring the target data by acquiring the first cookie value and send the data acquisition request to the server to enable the server to return the target data, the multiplexing of the first cookie value is realized, meanwhile, the page access window created through the host application program enables the operation of accessing the target data for multiple times to be simpler.
Referring to fig. 3, fig. 3 is a block diagram of an apparatus for acquiring data according to an embodiment of the present disclosure. The apparatus for acquiring data in this embodiment includes units for performing the steps in the embodiments corresponding to fig. 1 to 2. Please refer to fig. 1 to 2 and fig. 1 to 2 for the corresponding embodiments. For convenience of explanation, only the portions related to the present embodiment are shown. Referring to fig. 3, the apparatus 300 for acquiring data includes: a loading unit 31, a first fetching unit 32 and an execution unit 33. Wherein:
and the loading unit 31 is configured to acquire and load a target web page file through a page access window created in the host application to obtain a target web page.
A first obtaining unit 32, configured to, if a preset instruction for obtaining target data through the target web page is detected, obtain a first cookie value from a local database of the host application.
An executing unit 33, configured to identify the first cookie value as a target cookie value of the target web page, and send a data obtaining request carrying the target cookie value to a server through the target web page; and the server is used for returning the target data to the target webpage according to the target cookie value.
As an embodiment of the present application, the apparatus 300 for acquiring data further includes:
and the login unit 34 is configured to receive account information input by a user through the target webpage, and send a login request to a server according to the account information to receive a first cookie value returned by the server.
A storage unit 35, configured to store the first cookie value in a local database of the host application.
As an embodiment of the present application, the storage unit 35 is specifically configured to determine, according to the first cookie value, a file directory of the target web page from a local database of the host application program; storing the first cookie value in the file directory.
As an embodiment of the present application, the loading unit 31 is specifically configured to, if a preset operation of loading a target webpage file is monitored through a host application program, call a preset web-view component in the host application program to create a page access window; and loading a hypertext markup language (HMTL) file pointed by a Uniform Resource Locator (URL) in a web-view label through the page access window to obtain the target webpage.
As an embodiment of the present application, the first obtaining unit 32 is specifically configured to, if a preset instruction for obtaining target data through the target web page is detected, search a file directory corresponding to the target web page from a local database of the host application program; extracting the first cookie value from the file directory.
As an embodiment of the present application, the executing unit 33 is specifically configured to configure the first cookie value into the URL to obtain a new URL; and identifying the first cookie value as a target cookie value through the target webpage according to the new URL, and sending a data acquisition request carrying the target cookie value to a server.
As an embodiment of the present application, the executing unit 33 is specifically configured to configure the first cookie value to the URL through the web-view component in a way of passing through a reference in an address bar, so as to obtain a new URL.
As can be seen from the above, in the apparatus for acquiring data provided in this embodiment, a target web page is loaded through a page access window created in a host application, when a preset instruction for acquiring target data through the target web page is detected, a first cookie value is acquired from a local database of the host application, and the first cookie value is identified as a target cookie value of the target web page, because the first cookie value is a persistent cookie value, when a data acquisition request is sent to the server through the target web page, the server can determine the authority of this access according to the target cookie value carried in the data acquisition request, and further return the target data to the target web page, when a user accesses the target data through the target web page in the hybrid application again, the target data can be acquired without manually re-inputting an account and a password for login, thereby simplifying the operation of acquiring the target data, the automation level of repeatedly acquiring the target data is improved.
In addition, the account information input by the user is received through the target webpage, the login request is sent to the server according to the account information so as to receive the first cookie value returned by the server, and meanwhile, the first cookie value is stored in the local database of the host application program, so that when the target data is accessed next time, the terminal can generate a data acquisition request with the permission of acquiring the target data by acquiring the first cookie value and send the data acquisition request to the server to enable the server to return the target data, the multiplexing of the first cookie value is realized, meanwhile, the page access window created through the host application program enables the operation of accessing the target data for multiple times to be simpler.
Fig. 4 is a block diagram of a terminal device according to another embodiment of the present application. As shown in fig. 4, the terminal device 5 of this embodiment includes: a processor 50, a memory 51 and a computer program 52, e.g. a program of a method of acquiring data, stored in said memory 51 and executable on said processor 50. The processor 50, when executing the computer program 52, implements the steps of the above-described embodiments of the method for obtaining data, such as S11-S13 shown in fig. 1. Alternatively, when the processor 50 executes the computer program 52, the functions of the units in the embodiment corresponding to fig. 3, for example, the functions of the units 41 to 33 shown in fig. 3, are implemented, for which reference is specifically made to the relevant description in the embodiment corresponding to fig. 3, which is not repeated herein.
Illustratively, the computer program 52 may be divided into one or more units, which are stored in the memory 51 and executed by the processor 50 to accomplish the present application. The one or more units may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution process of the computer program 52 in the terminal device 5. For example, the computer program 52 may be divided into a loading unit, a first obtaining unit, and an executing unit, and the specific functions of each unit are as described above.
The terminal device may include, but is not limited to, a processor 50, a memory 51. Those skilled in the art will appreciate that fig. 4 is merely an example of a terminal device 5 and does not constitute a limitation of terminal device 5 and may include more or fewer components than shown, or some components may be combined, or different components, e.g., the terminal device may also include input-output devices, network access devices, buses, etc.
The Processor 50 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 51 may be an internal storage unit of the terminal device 5, such as a hard disk or a memory of the terminal device 5. The memory 51 may also be an external storage device of the terminal device 5, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the terminal device 5. Further, the memory 51 may also include both an internal storage unit and an external storage device of the terminal device 5. The memory 51 is used for storing the computer program and other programs and data required by the terminal device. The memory 51 may also be used to temporarily store data that has been output or is to be output.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.
Claims (10)
1. A method of acquiring data, comprising:
acquiring and loading a target webpage file through a page access window established in a host application program to obtain a target webpage;
if a preset instruction for acquiring target data through the target webpage is detected, acquiring a first cookie value from a local database of the host application program;
identifying the first cookie value as a target cookie value of the target webpage, and sending a data acquisition request carrying the target cookie value to the server through the target webpage; and the server is used for returning the target data to the target webpage according to the target cookie value.
2. The method of claim 1, wherein before the step of retrieving the first cookie value from the local database of the host application if the predetermined instruction for retrieving the target data through the target web page is detected, further comprising:
receiving account information input by a user through the target webpage, and sending a login request to a server according to the account information so as to receive a first cookie value returned by the server;
storing the first cookie value in a local database of the host application.
3. The method of claim 2, wherein storing the first cookie value in a local database of the host application comprises:
determining a file directory of the target webpage from a local database of the host application program according to the first cookie value;
storing the first cookie value in the file directory.
4. The method according to any one of claims 1 to 3, wherein the obtaining and loading the target webpage file through the page access window created in the host application to obtain the target webpage comprises:
if the preset operation of loading the target webpage file is monitored through the host application program, calling a preset web-view component in the host application program to create a page access window;
and loading a hypertext markup language (HMTL) file pointed by a Uniform Resource Locator (URL) in a web-view label through the page access window to obtain the target webpage.
5. The method of claim 3, wherein the obtaining the first cookie value from the local database of the host application if the predetermined instruction for obtaining the target data through the target webpage is detected comprises:
if a preset instruction for acquiring target data through the target webpage is detected, searching a file directory corresponding to the target webpage from a local database of the host application program;
extracting the first cookie value from the file directory.
6. The method of claim 4, wherein identifying the first cookie value as a target cookie value for the target web page and sending a data retrieval request carrying the target cookie value to the server via the target web page comprises:
configuring the first cookie value into the URL to obtain a new URL;
and identifying the first cookie value as a target cookie value through the target webpage according to the new URL, and sending a data acquisition request carrying the target cookie value to a server.
7. The method of claim 6, wherein the configuring the first cookie value into the URL resulting in a new URL comprises:
and configuring the first cookie value into the URL through the web-view component in an address bar parameter transmission mode to obtain a new URL.
8. An apparatus for acquiring data, comprising:
the loading unit is used for acquiring and loading a target webpage file through a page access window established in the host application program to obtain a target webpage;
a first obtaining unit, configured to obtain a first cookie value from a local database of the host application if a preset instruction for obtaining target data through the target web page is detected;
the execution unit is used for identifying the first cookie value as a target cookie value of the target webpage and sending a data acquisition request carrying the target cookie value to a server through the target webpage; and the server is used for returning the target data to the target webpage according to the target cookie value.
9. A terminal device, characterized in that the terminal device comprises a memory, a processor and a computer program stored in the memory and executable on the terminal device, the processor implementing the steps of the method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910762509.2A CN110633432A (en) | 2019-08-19 | 2019-08-19 | Method, device, terminal equipment and medium for acquiring data |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910762509.2A CN110633432A (en) | 2019-08-19 | 2019-08-19 | Method, device, terminal equipment and medium for acquiring data |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110633432A true CN110633432A (en) | 2019-12-31 |
Family
ID=68970560
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910762509.2A Pending CN110633432A (en) | 2019-08-19 | 2019-08-19 | Method, device, terminal equipment and medium for acquiring data |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110633432A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111563005A (en) * | 2020-04-02 | 2020-08-21 | 苏宁云计算有限公司 | Cookie data processing method and device, computer equipment and storage medium |
CN111596828A (en) * | 2020-05-14 | 2020-08-28 | 云账户技术(天津)有限公司 | Cookie synchronization method, device and computer readable storage medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107066491A (en) * | 2016-12-28 | 2017-08-18 | 北京五八信息技术有限公司 | The method and device of quick log-on webpage application |
CN107203576A (en) * | 2016-03-18 | 2017-09-26 | 北京京东尚科信息技术有限公司 | Information synchronization method and device |
CN107528830A (en) * | 2017-08-03 | 2017-12-29 | 携程旅游信息技术(上海)有限公司 | account login method, system and storage medium |
CN108259435A (en) * | 2016-12-29 | 2018-07-06 | 中国移动通信集团浙江有限公司 | Access the implementation method and device of the mixing application of Web components |
CN110113407A (en) * | 2019-04-30 | 2019-08-09 | 上海连尚网络科技有限公司 | Small routine state synchronization method, equipment and computer storage medium |
-
2019
- 2019-08-19 CN CN201910762509.2A patent/CN110633432A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107203576A (en) * | 2016-03-18 | 2017-09-26 | 北京京东尚科信息技术有限公司 | Information synchronization method and device |
CN107066491A (en) * | 2016-12-28 | 2017-08-18 | 北京五八信息技术有限公司 | The method and device of quick log-on webpage application |
CN108259435A (en) * | 2016-12-29 | 2018-07-06 | 中国移动通信集团浙江有限公司 | Access the implementation method and device of the mixing application of Web components |
CN107528830A (en) * | 2017-08-03 | 2017-12-29 | 携程旅游信息技术(上海)有限公司 | account login method, system and storage medium |
CN110113407A (en) * | 2019-04-30 | 2019-08-09 | 上海连尚网络科技有限公司 | Small routine state synchronization method, equipment and computer storage medium |
Non-Patent Citations (1)
Title |
---|
野狼谷: "android webview中的cookie操作", 《HTTPS://WWW.CNBLOGS.COM/YELANGGU/P/10870279.HTML》 * |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111563005A (en) * | 2020-04-02 | 2020-08-21 | 苏宁云计算有限公司 | Cookie data processing method and device, computer equipment and storage medium |
CN111563005B (en) * | 2020-04-02 | 2023-05-19 | 苏宁云计算有限公司 | Cookie data processing method and device, computer equipment and storage medium |
CN111596828A (en) * | 2020-05-14 | 2020-08-28 | 云账户技术(天津)有限公司 | Cookie synchronization method, device and computer readable storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11128621B2 (en) | Method and apparatus for accessing website | |
US10079854B1 (en) | Client-side protective script to mitigate server loading | |
CN104767775B (en) | Web application information push method and system | |
CN103607385B (en) | Method and apparatus for security detection based on browser | |
US8819819B1 (en) | Method and system for automatically obtaining webpage content in the presence of javascript | |
EP2985705A2 (en) | Webpage access method and apparatus, and router | |
US20100064234A1 (en) | System and Method for Browser within a Web Site and Proxy Server | |
WO2016101635A1 (en) | Method, apparatus and device for synchronizing login status, and computer storage medium | |
US20140297863A1 (en) | Managing redirected website login using a short address | |
CN108829838B (en) | Batch processing method of account information and server | |
CN107015996A (en) | A kind of resource access method, apparatus and system | |
CN106933871A (en) | Short linking processing method, device and short linked server | |
US20100306833A1 (en) | Autonomous intelligent user identity manager with context recognition capabilities | |
CN109688280A (en) | Request processing method, request processing equipment, browser and storage medium | |
CN106897336A (en) | Web page files sending method, webpage rendering intent and device, webpage rendering system | |
CN106649446B (en) | Information pushing method and device | |
CN106534268B (en) | Data sharing method and device | |
CN109600385B (en) | Access control method and device | |
CN110808868B (en) | Test data acquisition method and device, computer equipment and storage medium | |
CN104618388B (en) | Fast registration login method and corresponding resetting server, information server | |
CN107104924A (en) | The verification method and device of website backdoor file | |
US8789177B1 (en) | Method and system for automatically obtaining web page content in the presence of redirects | |
CN112637361A (en) | Page proxy method, device, electronic equipment and storage medium | |
CN110633432A (en) | Method, device, terminal equipment and medium for acquiring data | |
CN111770072B (en) | Method and device for accessing function page through single sign-on |
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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20191231 |
|
RJ01 | Rejection of invention patent application after publication |