File downloading method, device and storage medium

By directly downloading the file by obtaining the hyperlink tag of the download file from the web page, the complex and uncontrollable file download in the existing technology is solved, and a more stable and efficient download process is achieved.

CN112989233BActive Publication Date: 2024-12-03BEIJING XIAOMI MOBILE SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201911215313.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-12-02
Publication Date
2024-12-03
Estimated Expiration
2039-12-02

AI Technical Summary

Technical Problem

In the prior art, the file download process is complicated and uncontrollable, and multiple identity authentication and requesting requests for the server to provide a dedicated interface, resulting in cumbersome operations and poor stability.

Method used

By obtaining web page information, obtaining web page links containing download links, obtaining the hyperlink tag of the download file, and directly downloading the file through the hyperlink tag, avoiding multiple identity authentication and interface requests, and simplifying the download process.

Benefits of technology

It simplifies file download operations, improves the stability and efficiency of downloads, avoids problems such as token failure, and reduces dependence on server interfaces and programming and maintenance work.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112989233B_ABST
    Figure CN112989233B_ABST
Patent Text Reader

Abstract

The present disclosure discloses a file downloading method, device and storage medium, belonging to the field of data processing technology. The method comprises: obtaining web page information of each web page, then obtaining the web page link of a specified web page containing a download link through the web page information of each web page, then obtaining the hyperlink tag of the download file in the specified web page according to the web page link of the specified web page, and finally downloading the download file through the hyperlink tag of the download file. Through the above scheme, the information related to the download file can be directly obtained from the web page, avoiding multiple identity authentications and multiple requests to the server to provide a dedicated interface to obtain the information related to the download file, simplifying the operation of file downloading, and thus improving the stability of file downloading.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a file downloading method, device and storage medium. Background Art

[0002] Nowadays, with the increasing development of Internet technology, web pages, as the most basic elements of websites, have been widely used by the public.

[0003] Web pages contain a lot of information, including files that can be downloaded. In order to download files on a web page, you first need to provide the server with identity authentication information such as a token or key, and request the server to provide a dedicated interface to obtain information on the web page. Then you need to provide authentication information to the server, obtain the file download link through the dedicated interface, and finally provide authentication information to the server through the file download link, and request the server to provide a dedicated interface for downloading files to download the file.

[0004] However, in the related art, during the process of downloading files, multiple identity authentication requests are required to use a dedicated interface to download the file, which results in complicated file download operations and uncontrollable file download processes. Summary of the invention

[0005] The present disclosure provides a file downloading method, device and storage medium. The technical solution is as follows:

[0006] According to a first aspect of an embodiment of the present disclosure, a file downloading method is provided, wherein the method comprises:

[0007] Obtaining web page information of each web page, wherein the web page information is text information displayed on the corresponding web page;

[0008] Obtaining a webpage link of a designated webpage containing a download link through the webpage information of each webpage;

[0009] According to the webpage link of the designated webpage, obtaining a hyperlink tag of a download file in the designated webpage;

[0010] The download file is downloaded through the hyperlink tag of the download file.

[0011] Optionally, after downloading the download file through the hyperlink of the download file, the method further includes:

[0012] Obtaining a download file name of the download file according to a hyperlink tag of the download file;

[0013] The completion status of the downloaded file is determined according to the default download location and the downloaded file name, and the completion status is used to indicate whether the downloaded file is completed.

[0014] Optionally, determining the completion status of the downloaded file according to the default download location and the downloaded file name includes:

[0015] When a file corresponding to the download file name exists in the default download location, determining that the download of the download file is complete;

[0016] or,

[0017] When the default download location does not contain a file corresponding to the download file name, it is determined that the download of the download file is not completed.

[0018] Optionally, obtaining a webpage link of a designated webpage containing a download link through the webpage information of each webpage includes:

[0019] Parsing the webpage information of each webpage to obtain the download indication information contained in the webpage information of each webpage; the download indication information is information for indicating the download file;

[0020] According to the download instruction information contained in the web page information of each web page, the web page links of each designated web page are obtained by splicing.

[0021] Optionally, obtaining a hyperlink tag of a download file in the designated webpage according to the webpage link of the designated webpage includes:

[0022] Open the designated web page through the web link of the designated web page;

[0023] A hyperlink tag containing the download instruction information in the designated web page is retrieved as the hyperlink tag of the download file.

[0024] Optionally, parsing the webpage information of each webpage to obtain the download instruction information contained in the webpage information of each webpage includes:

[0025] The webpage information of each webpage is parsed, and the download instruction information contained in the webpage information of each webpage is acquired through XPath path language.

[0026] Optionally, downloading the download file through a hyperlink tag of the download file includes:

[0027] The download file is downloaded by simulating a trigger operation on a hyperlink tag of the download file.

[0028] According to a second aspect of an embodiment of the present disclosure, a file downloading device is provided, wherein the device comprises:

[0029] An information acquisition module, used to acquire web page information of each web page, wherein the web page information is text information displayed on the corresponding web page;

[0030] A web page acquisition module, used to acquire a web page link of a designated web page containing a download link through the web page information of each web page;

[0031] A hyperlink acquisition module, used for acquiring a hyperlink tag of a download file in the specified web page according to the web page link of the specified web page;

[0032] The file download module is used to download the download file through the hyperlink tag of the download file.

[0033] Optionally, the device further comprises:

[0034] A name acquisition module, used for acquiring the download file name of the download file according to the hyperlink tag of the download file after downloading the download file through the hyperlink of the download file;

[0035] The status determination module is used to determine the completion status of the downloaded file according to the default download location and the downloaded file name, and the completion status is used to indicate whether the downloaded file is downloaded completely.

[0036] Optionally, the state determination module includes:

[0037] A download completion submodule, used to determine that downloading of the download file is complete when a file corresponding to the download file name exists in the default download location;

[0038] or,

[0039] The download incomplete submodule is used to determine that the download of the download file is incomplete when there is no file corresponding to the download file name in the default download location.

[0040] Optionally, the webpage acquisition module includes:

[0041] An indication information acquisition submodule, used to parse the webpage information of each webpage, and acquire the download indication information contained in the webpage information of each webpage; the download indication information is information used to indicate the download file;

[0042] The link splicing submodule is used to splice the web page links of the designated web pages according to the download instruction information contained in the web page information of the web pages.

[0043] Optionally, the hyperlink acquisition module includes:

[0044] A web page opening submodule, used to open the specified web page through the web page link of the specified web page;

[0045] The hyperlink retrieval submodule is used to retrieve the hyperlink tag containing the download instruction information in the specified web page as the hyperlink tag of the download file.

[0046] Optionally, the indication information acquisition submodule is used to:

[0047] The webpage information of each webpage is parsed, and the download instruction information contained in the webpage information of each webpage is acquired through XPath path language.

[0048] Optionally, the file download module includes:

[0049] The file download submodule is used to download the download file by simulating a trigger operation on a hyperlink tag of the download file.

[0050] According to a third aspect of an embodiment of the present disclosure, a file downloading device is provided, the device comprising:

[0051] processor;

[0052] a memory for storing executable instructions for the processor;

[0053] Wherein, the processor is configured to:

[0054] Obtaining web page information of each web page, wherein the web page information is text information displayed on the corresponding web page;

[0055] Obtaining a webpage link of a designated webpage containing a download link through the webpage information of each webpage;

[0056] According to the webpage link of the designated webpage, obtaining a hyperlink tag of a download file in the designated webpage;

[0057] The download file is downloaded through the hyperlink tag of the download file.

[0058] According to a fourth aspect of an embodiment of the present disclosure, a computer device readable storage medium is provided, wherein the computer device readable storage medium contains executable instructions, and the executable instructions are called and executed by a processor to implement the file downloading method described in the above-mentioned first aspect or any optional scheme of the first aspect.

[0059] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects:

[0060] First, the web page information of each web page is obtained, wherein the web page information is the text information displayed on the corresponding web page, and then the web page link of the specified web page containing the download link is obtained through the web page information of each web page, and then the hyperlink tag of the download file in the specified web page is obtained according to the web page link of the specified web page, and finally the download file is downloaded through the hyperlink tag of the download file. Through the above scheme, the information related to the download file can be directly obtained from the web page, avoiding multiple identity authentications and multiple requests to the server to provide a dedicated interface to obtain the information related to the download file, simplifying the operation of file downloading, thereby improving the stability of file downloading.

[0061] It is to be understood that the foregoing general description and the following detailed description are exemplary only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0063] Figure 1 is a schematic diagram of an implementation environment according to an exemplary embodiment;

[0064] Figure 2 is a flow chart of a file downloading method according to an exemplary embodiment;

[0065] Figure 3 is a flowchart of a file downloading method according to another exemplary embodiment;

[0066] Figure 4 is a schematic diagram showing a file downloading method process according to another exemplary embodiment;

[0067] Figure 5 is a block diagram of a file downloading device according to an exemplary embodiment;

[0068] Figure 6 The diagram is a schematic diagram of the structure of a terminal according to an exemplary embodiment. DETAILED DESCRIPTION

[0069] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0070] It should be understood that the "several" mentioned in this article refers to one or more, and "multiple" refers to two or more. "And / or" describes the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects before and after are in an "or" relationship.

[0071] Figure 1 FIG. 1 is a schematic diagram showing an implementation environment according to an exemplary embodiment. The implementation environment includes a terminal 120 and a server 140 .

[0072] The terminal 120 and the server 140 are connected via a wired or wireless network.

[0073] The server 140 is a server, a server cluster consisting of several servers, or a cloud computing center.

[0074] Optionally, the wireless network or wired network described above uses standard communication technology and / or protocol. The network is typically the Internet, but may also be any network, including but not limited to a local area network (LAN), a metropolitan area network (MAN), a wide area network (WAN), a mobile, wired or wireless network, a dedicated network or any combination of a virtual private network). In some embodiments, technologies and / or formats including Hyper Text Mark-up Language (HTML), Extensible Markup Language (XML), etc. are used to represent data exchanged over the network. In addition, conventional encryption technologies such as Secure Socket Layer (SSL), Transport Layer Security (TLS), Virtual Private Network (VPN), Internet Protocol Security (IPsec), etc. may be used to encrypt all or some links. In other embodiments, customized and / or dedicated data communication technologies may also be used to replace or supplement the above data communication technologies.

[0075] Figure 2 FIG. 1 is a flowchart of a file downloading method according to an exemplary embodiment. Figure 2 As shown, the file download method can be applied to a terminal, by inputting an instruction in the terminal to obtain the downloaded file on the server side and store it in the terminal. For example, the terminal can be Figure 1 The terminal 120 shown in FIG. 1 may be a Figure 1 The server 140 shown. Figure 2 As shown, the file downloading method may include the following steps:

[0076] In step 201, web page information of each web page is obtained, where the web page information is text information displayed on the corresponding web page.

[0077] In step 202, a webpage link of a designated webpage including a download link is obtained through the webpage information of each webpage.

[0078] In step 203, a hyperlink tag of a download file in the designated web page is obtained according to the web page link of the designated web page.

[0079] In step 204, the download file is downloaded through the hyperlink tag of the download file.

[0080] Optionally, after downloading the download file through the hyperlink of the download file, the method further includes:

[0081] According to the hyperlink tag of the download file, obtain the download file name of the download file;

[0082] The completion status of the downloaded file is determined according to the default download location and the name of the downloaded file, and the completion status is used to indicate whether the downloaded file is completed.

[0083] Optionally, determining the completion status of the downloaded file according to the default download location and the downloaded file name includes:

[0084] When a file corresponding to the name of the downloaded file exists in the default download location, determining that the download of the downloaded file is complete;

[0085] or,

[0086] When the default download location does not contain a file corresponding to the name of the file to be downloaded, it is determined that the download of the download file is not completed.

[0087] Optionally, obtaining a webpage link of a designated webpage containing a download link through the webpage information of each webpage includes:

[0088] Parsing the webpage information of each webpage to obtain the download indication information contained in the webpage information of each webpage; the download indication information is information for indicating the download file;

[0089] According to the download instruction information contained in the web page information of each web page, the web page links of each designated web page are obtained by splicing.

[0090] Optionally, obtaining a hyperlink tag of a download file in the designated webpage according to the webpage link of the designated webpage includes:

[0091] Open the designated web page through the web link of the designated web page;

[0092] A hyperlink tag containing the download instruction information in the designated webpage is retrieved as the hyperlink tag of the download file.

[0093] Optionally, parsing the webpage information of each webpage to obtain the download instruction information contained in the webpage information of each webpage includes:

[0094] The webpage information of each webpage is parsed, and the download instruction information contained in the webpage information of each webpage is obtained through the XPath path language.

[0095] Optionally, downloading the download file through a hyperlink tag of the download file includes:

[0096] The download file is downloaded by simulating a trigger operation on the hyperlink tag of the download file.

[0097] In summary, the file download method provided in the embodiment of the present disclosure first obtains the web page information of each web page, wherein the web page information is the text information displayed on the corresponding web page, and then obtains the web page link of the specified web page containing the download link through the web page information of each web page, and then obtains the hyperlink tag of the download file in the specified web page according to the web page link of the specified web page, and finally downloads the download file through the hyperlink tag of the download file. Through the above scheme, the information related to the download file can be directly obtained from the web page, avoiding multiple identity authentications and multiple requests to the server to provide a dedicated interface to obtain the information related to the download file, simplifying the operation of file downloading, and thus improving the stability of file downloading.

[0098] Figure 3 is a flowchart of a file downloading method according to another exemplary embodiment. Figure 3 As shown, the file download method can be applied to a terminal, and the downloaded file is obtained from the server side and stored in the terminal by inputting instructions in the terminal. For example, the terminal can be Figure 1 The terminal 120 shown in FIG. 1 may be a Figure 1 The server 140 shown. Figure 3 As shown, the file downloading method may include the following steps:

[0099] In step 301, the terminal obtains web page information of each web page.

[0100] In the disclosed embodiment, the terminal can obtain a browser instance of a driver software (WebDriver) in a web page according to the path information of the driver software (e.g., ChromeDriver) in the browser, and then use the browser instance of WebDriver to open a specified web page and obtain the web page information of the opened specified web page.

[0101] The web page information is the text information displayed on the corresponding web page. WebDriver is an automated testing tool that can implement web page simulation click technology by inputting instruction codes to control the web page.

[0102] For example, getting a WebDriver browser instance based on the ChromeDriver path information can be achieved by entering the following code in WebDriver:

[0103] webdriver.Chrome(executable_path="C:\\Users\\xy\\Desktop\\chromedriver.exe")

[0104] The path information of ChromeDriver is "C:\\Users\\xy\\Desktop\\chromedriver.exe". After obtaining the browser instance, you can maximize the browser window by entering the code browser.maximize_window() in WebDriver.

[0105] Optionally, the designated web page for obtaining web page information may be one or more. When there is one designated web page, the URL of the designated web page may be manually input, or when there are multiple designated web pages, the URL of the designated web page may be automatically input through code according to a certain rule.

[0106] For example, when the URL of the specified webpage is xxx.nxcom, you can open the specified webpage by entering the following code in WebDriver:

[0107] browser.get("https: / / xxx.nxcom / issues / ?filter=27256")

[0108] Optionally, if the specified web page for obtaining web page information requires a user name and password to access, the login to the specified web page can be achieved by entering the corresponding user name and password in the form of code in WebDriver.

[0109] For example, if the username of the specified web page is XXX and the corresponding password is AAA, the login can be performed by entering the following code in WebDriver:

[0110] browser.find_element_by_id("input-username").send_keys("XXX")

[0111] browser.find_element_by_id("password").send_keys("AAA")

[0112] After entering the corresponding username and password in WebDriver, the user can simulate clicking the login button by then entering the code browser.find_element_by_xpath(" / / *[text()='Login']").click() in WebDriver.

[0113] In step 302, the terminal obtains the web page link of the specified web page containing the download link through the web page information of each web page.

[0114] In the embodiments of the present disclosure, each web page includes a web page containing a download link and a web page without a download link, and the terminal can obtain the web page link of the web page containing the download link from each web page.

[0115] Optionally, parse the web page information of each web page to obtain the download indication information included in the web page information of each web page.

[0116] Wherein, the download indication information is information used to indicate the downloaded file.

[0117] For example, if the downloaded file is an installation package file, its download indication information can be version number information, model information, etc.

[0118] Optionally, parse the web page information of each web page, and obtain the download indication information included in the web page information of each web page through the XPath path language.

[0119] Wherein, XPath is a path language that uses path expressions to select nodes or node sets in an XML (Extensible Markup Language) document. Users can enter the XPath language in WebDriver to select the download instruction information included in the web page information of each web page.

[0120] For example, if you need to obtain the download instruction information in the web page information as version number information, you can enter the following code in WebDriver to obtain the version number information in the web page information.

[0121] versions=browser.find_elements_by_xpath(" / / td[@class='versions']")

[0122] In addition, the terminal can obtain download instruction information in more than one web page by inputting corresponding instruction codes in WebDriver, and can obtain each download instruction information in each web page information by traversing each web page information.

[0123] For example, by entering the code for versions_every in versions:print(versions_every.text) in WebDriver, you can get the version number information in each web page information.

[0124] Optionally, web page links of the designated web pages are obtained by splicing according to the download instruction information included in the web page information of the web pages.

[0125] After obtaining each download indication information in each web page information, in order to obtain the web page link where the download file corresponding to each download indication information is located, the web page link can be obtained in the following manner:

[0126] Because each web page has a fixed URL, by adding corresponding download instruction information after the fixed URL, the URL of the web page where the file corresponding to the download instruction information is located can be obtained.

[0127] For example, if the fixed URL of the webpage is http: / / xpkcom / le / la? r=, the file to be downloaded is an installation package file, and the download instruction information corresponding to the file is the version number information of the installation package, and the version number information is V1.0.0.1.ABCD, the webpage link corresponding to the download of the file can be obtained by splicing the fixed URL of the webpage with the version number information. According to the above content, the webpage link for downloading the file can be obtained as http: / / xpkcom / le / la? r=V1.0.0.1.ABCD.

[0128] In step 303, the terminal obtains a hyperlink tag of a download file in the designated web page according to the web page link of the designated web page.

[0129] In the embodiment of the present disclosure, a web page containing a file to be downloaded is used to obtain a hyperlink tag corresponding to the file to be downloaded in the web page.

[0130] Optionally, the terminal may open the designated web page through a web link of the designated web page.

[0131] Among them, the web page with a known web link can be opened through the browser instance of WebDriver.

[0132] For example, when the webpage link is http: / / xpkcom / le / la?r=V1.0.0.1.ABCD, the webpage can be opened by inputting the code: browser.get("http: / / xpkcom / le / la?r=V1.0.0.1.ABCD").

[0133] Optionally, the terminal retrieves a hyperlink tag containing the download instruction information in the designated webpage as the hyperlink tag of the download file.

[0134] After opening the specified webpage, by entering the code, you can match the hyperlink tag corresponding to the downloaded file. The code is as follows:

[0135] browser.find_elements_by_partial_link_text("version number information")

[0136] In step 304, the terminal downloads the download file through the hyperlink tag of the download file.

[0137] Optionally, the download file is downloaded by simulating a trigger operation on a hyperlink tag of the download file.

[0138] Among them, by inputting the code browser.find_elements_by_partial_link_text("version number information")[0].click(), a simulated trigger operation is performed on the download file corresponding to the version information, and the hyperlink that performs the simulated trigger operation can download the file corresponding to the hyperlink.

[0139] In step 305, the terminal obtains the download file name of the download file according to the hyperlink tag of the download file.

[0140] In the embodiment of the present disclosure, the terminal retrieves a hyperlink tag containing download instruction information on a specified web page as the hyperlink tag of the download file, and then uses the hyperlink to The tag gets the name of the file to be downloaded.

[0141] Among them, by entering the code browser.find_elements_by_partial_link_text("version number information")[0].text, you can get the file name of the downloaded file corresponding to the version number information.

[0142] In step 306, the terminal determines the completion status of the download file according to the default download location and the name of the download file.

[0143] In the disclosed embodiment, the terminal determines the completion status of the downloaded file by checking whether there is a downloaded file with the corresponding file name in the default download location of the browser used for downloading the file, wherein the completion status is used to indicate whether the downloaded file is completed.

[0144] Optionally, when a file corresponding to the name of the file to be downloaded exists in the default download location, it is determined that the downloading of the download file is complete; or, when a file corresponding to the name of the file to be downloaded does not exist in the default download location, it is determined that the downloading of the download file is incomplete.

[0145] Among them, the terminal sets a time threshold. When the time threshold is reached, the terminal searches once whether there is a download file with the corresponding file name in the default download location of the browser. If the search result is that there is a download file with the corresponding file name, it means that the download file has been downloaded. If the search result is that there is no download file with the corresponding file name, it means that the download file has not been downloaded. At this time, you can continue to wait for a time threshold and the terminal will search again until the search result is that there is a download file with the corresponding file name, that is, the download of the download file is completed.

[0146] For example, if the time threshold is set to 10s, you can enter the code:

[0147] while not os.path.exists(this_name):

[0148] time.sleep(10)

[0149] The above code can be used to execute the operation of the terminal waiting for 10 seconds to detect whether there is a download file with the corresponding file name in the default download location of the browser.

[0150] Optionally, after the download file is downloaded, the downloaded file is stored in the memory of the terminal, and the user performs basic operations such as decompression, renaming, copying or moving the downloaded file. Since in the related art, file downloading requires cooperation from multiple parties, the related art is to manually check and save a large amount of web page information (such as version number information) every day, and manually download files according to a large amount of web page information (such as version number information) every day. In this case, the present application solves this problem. The present solution is simple to operate and has strong operability, which greatly improves the efficiency of downloading files. At the same time, viewing, saving web page information and downloading files through the program will be more stable, reliable and efficient than manually viewing, saving web page information and downloading files. At the same time, it also solves the problem that the related technology requires cooperation from multiple parties, cumbersome operations and too much dependence. It avoids relying on the independent interface provided by the server, avoids the authentication work through cumbersome information such as tokens and keys, thereby avoiding problems such as authentication failure caused by token failure, and thus avoiding the problem of uncontrollable results; it avoids the workload of the server cooperating with the development and maintenance of independent interfaces, thereby saving a lot of programming, code updates and code maintenance work. In addition, the present application does not require a download link for the file to be downloaded, thus solving the problem of poor security of the related technology.

[0151] In summary, the file download method provided in the embodiment of the present disclosure first obtains the web page information of each web page, wherein the web page information is the text information displayed on the corresponding web page, and then obtains the web page link of the specified web page containing the download link through the web page information of each web page, and then obtains the hyperlink tag of the download file in the specified web page according to the web page link of the specified web page, and finally downloads the download file through the hyperlink tag of the download file. Through the above scheme, the information related to the download file can be directly obtained from the web page, avoiding multiple identity authentications and multiple requests to the server to provide a dedicated interface to obtain the information related to the download file, simplifying the operation of file downloading, and thus improving the stability of file downloading.

[0152] Figure 4 is a schematic diagram showing a file downloading method flow according to another exemplary embodiment. Figure 4 As shown, taking the downloaded file as an installation package file as an example, the process of the file download method is as follows:

[0153] The S41 terminal obtains a WebDriver instance (browser) through the chromedriver path. The implementation method is to enter the following code in WebDriver:

[0154] webdriver.Chrome(executable_path="C:\\Users\\xy\\Desktop\\chromedriver.exe")

[0155] The S42 terminal uses the WebDriver instance (browser) to maximize the browser. This is done by entering the following command code in WebDriver:

[0156] browser.maximize_window()

[0157] The S43 terminal uses the WebDriver instance (browser) to open the specified web page. The implementation method is to enter the following code in WebDriver:

[0158] browser.get("https: / / xxx.nxcom / issues / ?filter=27256").

[0159] The S44 terminal uses the WebDriver instance (browser) to enter the username and password. The implementation method is to enter the following code in WebDriver:

[0160] browser.find_element_by_id("input-username").send_keys("XXX")

[0161] browser.find_element_by_id("password").send_keys("AAA")

[0162] The S45 terminal uses the WebDriver instance (browser) to simulate clicking the login button. The implementation method is to enter the following code in WebDriver:

[0163] browser.find_element_by_xpath(" / / *[text()='Login']").click().

[0164] The S46 terminal uses the WebDriver instance (browser) to obtain all required version number information through XPath. The implementation method is to enter the following code in WebDriver:

[0165] versions=browser.find_elements_by_xpath(" / / td[@class='versions']")

[0166] The S47 terminal traverses the list and reads each required information. This is achieved by entering the following code in WebDriver:

[0167] for versions_every in versions:

[0168] print(versions_every.text)

[0169] The S48 terminal closes the browser. To do this, enter the following code in WebDriver:

[0170] browser.quit()

[0171] The S49 terminal assembles a web page link containing a file download link based on the obtained web page information (for example, version number information here); N (N≥1) web page information corresponds to N (N≥1) web page links containing a file download link;

[0172] The S410 terminal uses the WebDriver instance (browser) to open the specified web page. The implementation method is to enter the following command code in WebDriver:

[0173] browser.get("http: / / xpkcom / le / la?r=V1.0.0.1.ABCD")

[0174] S411 The terminal matches the hyperlink containing the file download link according to the obtained web page information (for example, version number information here). Tags, by hyperlink The tag gets the full name of the file to be downloaded. The implementation method is to enter the following command code in WebDriver:

[0175] browser.find_elements_by_partial_link_text("version number information")[0].text

[0176] S412 The terminal matches the hyperlink containing the file download link according to the obtained web page information (for example, version number information here). Tag, and click this hyperlink tag. The implementation method is to enter the following command code in WebDriver:

[0177] browser.find_elements_by_partial_link_text("Version number information")[0].click().

[0178] The S413 terminal determines whether the file has been downloaded based on the default download location of the browser and the full name of the file to be downloaded. If not, it waits for 10 seconds and then determines whether the download is complete. The implementation method is to enter the following command code in WebDriver:

[0179] while not os.path.exists(this_name):

[0180] time.sleep(10)

[0181] S414 After the file download is completed, some operations can be performed on the downloaded file according to the user's needs, such as: decompression, renaming, copying, moving, etc.

[0182] The S415 terminal closes the browser. The implementation method is to enter the following command code in WebDriver:

[0183] browser.quit()

[0184] In summary, the file download method provided in the embodiment of the present disclosure first obtains the web page information of each web page, wherein the web page information is the text information displayed on the corresponding web page, and then obtains the web page link of the specified web page containing the download link through the web page information of each web page, and then obtains the hyperlink tag of the download file in the specified web page according to the web page link of the specified web page, and finally downloads the download file through the hyperlink tag of the download file. Through the above scheme, the information related to the download file can be directly obtained from the web page, avoiding multiple identity authentications and multiple requests to the server to provide a dedicated interface to obtain the information related to the download file, simplifying the operation of file downloading, and thus improving the stability of file downloading.

[0185] Figure 5 is a block diagram of a file downloading device according to an exemplary embodiment. Figure 5 As shown, the file download method can be applied to a terminal, and the downloaded file is obtained from the server side and stored in the terminal by inputting instructions in the terminal. For example, the terminal can be Figure 1 The terminal 120 shown in FIG. 1 may be a Figure 1 The server 140 shown in FIG. 1 is used in a terminal as an example. Figure 5 As shown, the file downloading device may include:

[0186] The information acquisition module 510 is used to acquire web page information of each web page, where the web page information is text information displayed on the corresponding web page;

[0187] The webpage acquisition module 520 is used to acquire the webpage link of the designated webpage containing the download link through the webpage information of each webpage;

[0188] A hyperlink acquisition module 530 is used to acquire a hyperlink tag of a download file in the specified webpage according to the webpage link of the specified webpage;

[0189] The file download module 540 is used to download the download file through the hyperlink tag of the download file.

[0190] Optionally, the device further comprises:

[0191] A name acquisition module, used for acquiring the download file name of the download file according to the hyperlink tag of the download file after downloading the download file through the hyperlink of the download file;

[0192] The status determination module is used to determine the completion status of the downloaded file according to the default download location and the downloaded file name, and the completion status is used to indicate whether the downloaded file is downloaded completely.

[0193] Optionally, the state determination module includes:

[0194] A download completion submodule, used to determine that downloading of the download file is complete when a file corresponding to the download file name exists in the default download location;

[0195] or,

[0196] The download incomplete submodule is used to determine that the download of the download file is incomplete when there is no file corresponding to the download file name in the default download location.

[0197] Optionally, the webpage acquisition module 520 includes:

[0198] An indication information acquisition submodule, used to parse the webpage information of each webpage, and acquire the download indication information contained in the webpage information of each webpage; the download indication information is information used to indicate the download file;

[0199] The link splicing submodule is used to splice the web page links of the designated web pages according to the download instruction information contained in the web page information of the web pages.

[0200] Optionally, the hyperlink acquisition module 530 includes:

[0201] A web page opening submodule, used to open the specified web page through the web page link of the specified web page;

[0202] The hyperlink retrieval submodule is used to retrieve the hyperlink tag containing the download instruction information in the specified web page as the hyperlink tag of the download file.

[0203] Optionally, the indication information acquisition submodule is used to:

[0204] The webpage information of each webpage is parsed, and the download instruction information contained in the webpage information of each webpage is acquired through XPath path language.

[0205] Optionally, the file download module 540 includes:

[0206] The file download submodule is used to download the download file by simulating a trigger operation on a hyperlink tag of the download file.

[0207] One point that needs to be explained is that the device provided in the above embodiment only uses the division of the above-mentioned functional modules as an example to implement its functions. In actual applications, the above-mentioned functions can be assigned to different functional modules according to actual needs, that is, the content structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0208] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0209] An exemplary embodiment of the present disclosure provides a file downloading device, which can be implemented as all or part of a terminal by hardware or a combination of hardware and software, and can implement the above-mentioned Figure 2 or Figure 3 All or part of the steps in any of the embodiments shown, the file downloading method can be applied to a terminal, wherein the download file is obtained from the server side and stored in the terminal by inputting instructions in the terminal. For example, the terminal can be Figure 1 The terminal 120 shown in FIG. 1 may be a Figure 1 The server 140 is shown. The device is used in a terminal as an example. The file downloading device also includes: a processor, a memory for storing processor executable instructions;

[0210] The processor is configured as follows:

[0211] Obtaining web page information of each web page, wherein the web page information is text information displayed on the corresponding web page;

[0212] Obtaining a webpage link of a designated webpage containing a download link through the webpage information of each webpage;

[0213] According to the webpage link of the designated webpage, obtaining a hyperlink tag of a download file in the designated webpage;

[0214] The download file is downloaded through the hyperlink tag of the download file.

[0215] Optionally, determining the completion status of the downloaded file according to the default download location and the downloaded file name includes:

[0216] When a file corresponding to the download file name exists in the default download location, determining that the download of the download file is complete;

[0217] or,

[0218] When the default download location does not contain a file corresponding to the download file name, it is determined that the download of the download file is not completed.

[0219] Optionally, obtaining a webpage link of a designated webpage containing a download link through the webpage information of each webpage includes:

[0220] Parsing the webpage information of each webpage to obtain the download indication information contained in the webpage information of each webpage; the download indication information is information for indicating the download file;

[0221] According to the download instruction information contained in the web page information of each web page, the web page links of each designated web page are obtained by splicing.

[0222] Optionally, obtaining a hyperlink tag of a download file in the designated webpage according to the webpage link of the designated webpage includes:

[0223] Open the designated web page through the web link of the designated web page;

[0224] A hyperlink tag containing the download instruction information in the designated web page is retrieved as the hyperlink tag of the download file.

[0225] Optionally, parsing the webpage information of each webpage to obtain the download instruction information contained in the webpage information of each webpage includes:

[0226] The webpage information of each webpage is parsed, and the download instruction information contained in the webpage information of each webpage is acquired through XPath path language.

[0227] Optionally, downloading the download file through a hyperlink tag of the download file includes:

[0228] The download file is downloaded by simulating a trigger operation on a hyperlink tag of the download file.

[0229] Figure 6 6 is a schematic diagram of the structure of a terminal according to an exemplary embodiment. The terminal 600 includes a central processing unit (CPU) 601, a system memory 604 including a random access memory (RAM) 602 and a read-only memory (ROM) 603, and a system bus 605 connecting the system memory 604 and the central processing unit 601. The terminal 600 also includes a basic input / output (I / O) system 606 for helping to transmit information between various devices in the terminal, and a large-capacity storage device 607 for storing an operating system 613, an application program 614 and other program modules 615.

[0230] The basic input / output system 606 includes a display 608 for displaying information and an input device 609 such as a mouse and a keyboard for user inputting information. The display 608 and the input device 609 are connected to the central processing unit 601 through an input / output controller 610 connected to the system bus 605. The basic input / output system 606 may also include an input / output controller 610 for receiving and processing inputs from a plurality of other devices such as a keyboard, a mouse, or an electronic stylus. Similarly, the input / output controller 610 also provides output to a display screen, a printer, or other types of output devices.

[0231] The mass storage device 607 is connected to the central processing unit 601 via a mass storage controller (not shown) connected to the system bus 605. The mass storage device 607 and its associated computer readable medium provide non-volatile storage for the terminal 600. That is, the mass storage device 607 may include a computer readable medium (not shown) such as a hard disk or a compact disc read-only memory (CD-ROM) drive.

[0232] Without loss of generality, the computer device readable medium may include computer device storage media and communication media. Computer device storage media include volatile and non-volatile, removable and non-removable media implemented by any method or technology for storing information such as computer device readable instructions, data structures, program modules or other data. Computer device storage media include RAM, ROM, Erasable Programmable Read-Only Memory (EPROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), flash memory or other solid-state storage technology, CD-ROM, Digital Video Disc (DVD) or other optical storage, cassette, tape, disk storage or other magnetic storage devices. Of course, those skilled in the art will know that the computer device storage medium is not limited to the above. The above-mentioned system memory 604 and mass storage device 607 can be collectively referred to as memory.

[0233] According to various embodiments of the present disclosure, the terminal 600 can also be connected to a remote terminal on a network through a network such as the Internet. That is, the terminal 600 can be connected to the network 612 through a network interface unit 611 connected to the system bus 605, or the network interface unit 611 can be used to connect to other types of networks or remote terminal systems (not shown).

[0234] The memory also includes one or more programs, which are stored in the memory. The CPU 601 implements the one or more programs by executing the one or more programs. Figure 2 or Figure 3 All or part of the steps of the method shown.

[0235] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the embodiments of the present disclosure can be implemented with hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer device readable medium or transmitted as one or more instructions or codes on a computer device readable medium. Computer device readable media include computer device storage media and communication media, wherein the communication medium includes any medium that facilitates the transmission of computer device programs from one place to another. The storage medium can be any available medium that a general or dedicated server can access.

[0236] The embodiment of the present disclosure also provides a computer device storage medium for storing computer device software instructions used for the above-mentioned testing device, which includes a program designed for executing the above-mentioned file downloading method.

[0237] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0238] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A file downloading method, characterized in that: The method is executed by a terminal, and includes: Acquire web page information of each web page, wherein the web page information is text information displayed on the corresponding web page, and the web page has a fixed URL; Parsing the webpage information of each webpage to obtain download instruction information contained in the webpage information of each webpage; the download instruction information is information for indicating downloading a file, and the download instruction information includes version number information or model information; Add the download indication information of the corresponding web page after the fixed URL, and splice to obtain web page links of each designated web page containing a download link; wherein the web page link is a link to the web page where the download file corresponding to the download indication information is located; Open the designated web page through the web link of the designated web page; Retrieving a hyperlink tag containing the download instruction information on the designated web page as the hyperlink tag for the download file; The download file is downloaded by simulating a trigger operation through a hyperlink tag of the download file.

2. The method according to claim 1, characterized in that After the simulated trigger operation is performed through the hyperlink tag of the download file and the download file is downloaded, the method further includes: Obtaining a download file name of the download file according to a hyperlink tag of the download file; The completion status of the downloaded file is determined according to the default download location and the downloaded file name, and the completion status is used to indicate whether the downloaded file is completed.

3. The method according to claim 2, characterized in that The step of determining the completion status of the downloaded file according to the default download location and the downloaded file name includes: When a file corresponding to the download file name exists in the default download location, determining that the download of the download file is complete; or, When the default download location does not contain a file corresponding to the download file name, it is determined that the download of the download file is not completed.

4. The method according to claim 1, characterized in that: The parsing of the webpage information of each webpage to obtain the download instruction information contained in the webpage information of each webpage includes: The webpage information of each webpage is parsed, and the download instruction information contained in the webpage information of each webpage is acquired through XPath path language.

5. A file downloading device, characterized in that: The device comprises: An information acquisition module, used to acquire web page information of each web page, wherein the web page information is text information displayed on the corresponding web page, and the web page has a fixed URL; a web page acquisition module, configured to parse the web page information of each web page, and acquire the download instruction information contained in the web page information of each web page; the download instruction information is information used to instruct the download of a file, and the download instruction information includes version number information or model information; the download instruction information of the corresponding web page is added after the fixed URL, and the web page links of each designated web page containing the download link are obtained by splicing; wherein the web page link is a link to the web page where the download file corresponding to the download instruction information is located; A hyperlink acquisition module, used to open the specified web page through the web link of the specified web page; retrieve the hyperlink tag containing the download instruction information in the specified web page as the hyperlink tag of the download file; The file download module is used to simulate a trigger operation through a hyperlink tag of the download file to download the download file.

6. The device according to claim 5, characterized in that The device also includes: A name acquisition module, used for acquiring the download file name of the download file according to the hyperlink tag of the download file after downloading the download file through the hyperlink of the download file; The status determination module is used to determine the completion status of the downloaded file according to the default download location and the downloaded file name, and the completion status is used to indicate whether the downloaded file is downloaded completely.

7. The device according to claim 6, characterized in that The state determination module comprises: A download completion submodule, used to determine that downloading of the download file is complete when a file corresponding to the download file name exists in the default download location; or, The download incomplete submodule is used to determine that the download of the download file is incomplete when there is no file corresponding to the download file name in the default download location.

8. The device according to claim 5, characterized in that The webpage acquisition module is also used to: The webpage information of each webpage is parsed, and the download instruction information contained in the webpage information of each webpage is acquired through XPath path language.

9. A file downloading device, characterized in that: The device comprises: processor; a memory for storing executable instructions for the processor; Wherein, the processor is configured to: Acquire web page information of each web page, wherein the web page information is text information displayed on the corresponding web page, and the web page has a fixed URL; Parsing the webpage information of each webpage to obtain download instruction information contained in the webpage information of each webpage; the download instruction information is information for indicating downloading a file, and the download instruction information includes version number information or model information; Add the download indication information of the corresponding web page after the fixed URL, and splice to obtain web page links of each designated web page containing a download link; wherein the web page link is a link to the web page where the download file corresponding to the download indication information is located; Open the designated web page through the web link of the designated web page; Retrieving a hyperlink tag containing the download instruction information on the designated web page as the hyperlink tag for the download file; The download file is downloaded by simulating a trigger operation through a hyperlink tag of the download file.

10. A computer device readable storage medium, characterized in that: The computer device readable storage medium contains executable instructions, and the executable instructions are called and executed by the processor to implement the file downloading method described in any one of claims 1 to 4 above.