If you're still having headaches with Python's various urllib and urlibs,cookielib, or are still mad about Python's emulation of logging in and crawling data, take a look at our recommended Requests,python acquisition data emulation login Essentials!
This is also the recommended HTTP client library for Python:
This article is an example of a simulation login to illustrate, as for the collection of people please do it yourself.
The code is very simple, mainly to show the Python requests library is extremely simple, the code is as follows:
s = requests.session () data = {' user ': ' username ', ' passdw ': ' Password '} #post replaced with the address of the login, Res=s.post (' http://www.xxx.net/index.php? Action=login ', data); #换成抓取的地址s. Get (' http://www.xxx.net/archives/155/');
See! With just 4 lines of code, you can simulate logins.