3. Process the requested data.

King of Glory as one of the most popular games, inside the character information is lifelike, but restricted by the official website, it is difficult to download a high-definition picture. (Image copyright).

Take the other side of the desktop this site as an example, climb the king of glory picture information.

【 II. Project Objectives 】

The realization will obtain the picture batch download.

[III. Libraries and Websites involved]

1. The website is as follows:

Libraries involved: Requests, LXML

Iv. Project Analysis

First, you need to figure out how to request the next page url. You can click the button on the next page and observe the changes to the site as shown below:

Only index_() was observed to change, which was replaced with {}, and the for loop was used to iterate over the url to implement multiple url requests.

V. Project Implementation

1. We define a class that inherits object, init that inherits self, and a main function that inherits self. Prepare the URL address and request headers.

2. Request to the website.

3. Process the requested data

4. In Chrome, right-click Developer Tools or press F12.

5. Right-click to check and find the link of the page of the image level 2, as shown below.

6, the secondary page request, for traversal obtained URL.

7. Write the obtained picture into the document and get the title value of the picture as the name of the picture.

8. Call the main method, as shown below. Because the website of the first page is not regular, so here is the first judgment is not the first page.

[VI. Effect Display]

1. Run the program and enter the number of pages you want to climb in the console, as shown below.

2. Display the downloaded picture on the console, as shown below.

3. Local renderings can be seen, as shown below.

【 VII. Summary 】

1. It is not recommended to grab too much data, which is easy to load the server.

2. We hope that through this project, we can help you download high definition pictures.

3. This paper is based on Python network crawler and uses crawler library to realize the capture of King of Glory pictures. When realizing, there will always be a variety of problems, do not have high expectations and low hands, work frequently, can understand more profound.

4, there are many heroes, we choose your favorite hero as your desktop wallpaper.

This article reprinted text, copyright belongs to the author, such as infringement contact xiaobian delete!

The original address: www.tuicool.com/articles/2a…

Need source code or want to learn moreClick here to download