Before we climbed are those who do not need to login to be able to use the site but when we want to crawl themselves or other people's personal center need to do login, generally enter the login page there are two, one is a separate page landing, the other is the pop-up window, we first regardless of the verification code landing problem, now try a direct landing crawl:
Reptiles are simulated human behavior to request a webpage to read the data now we divide the process, from landing to acquiring:
Let's take a look at the process of our personal center:
Login interface, enter your account password, enter your personal center
1 Enter the landing page can be said that the first request at this time will produce the corresponding cookie value, because you only need to enter the page before you can enter the password and other behavior
Cookiejar:1 to open Cookie record
Now look at the callback function:
2 Enter the landing page after the input data behavior, in the form of a POST request, the data transmitted in the network to find the field, is generally number,username what the data as a post carry
Look at the results.
3 before the request is the landing page with a GET request, now need to do a step login process becomes a POST request, that is, the second step request, the same is done in the parse function
4 meta={' Cookiejar ': True} means using the licensed cookie to access pages that need to be logged in to view
5 Obtain the cookie after the request, respond to the cookie, and then proceed to get the personal center:
Look at the results:
Python3 under Scrapy Crawler (Volume Fifth: Using cookies to simulate Landing Crawl Personal Center page)