Python uses cookies to simulate the login status.
For crawler operations that need to be performed in the login environment, it is a requirement to simulate login or disguise the logged-on status.
After analyzing the online simulated login examples, many of them initiate a post request based on the user name/password. If there is an image verification code, the ideal method is manual intervention, synchronously initiate a request for an image verification code, write the image locally, manually view it, and enter it.
Since manual intervention is indispensable, why does the login operation fail to be performed manually throughout the process? After logging on, I copy all the Cookie information in the browser and use crawlers to forge a browser that has been logged on? I have tried several major Chinese websites for the moment and found that they all work. I can simulate a lot of operations after logging on to the browser, including sign-in and personal data modification.
The following is a simple code implementation:
Afterwards: why is there no need to implement automatic identification for image verification codes?
Because it is as simple as the following, you may be able to do it in a few days:
However, the verification codes of many websites will constantly change their policies. It may change quickly once, but it may take several days for you to change the code. Maybe you have not completed the modification yet, people have changed again. In short, you can also die when you play.
When it wants to give you a surprise in another way, if you haven't cracked its last verification code, you will surely regret that the University has chosen the wrong major:
In order to develop the automatic ticket snatching software, 360 of the users used a high-tech team, and it seemed that they could not fully identify the following anti-human verification code:
The above is a preliminary study on simulating the login status of python through cookies. I hope it will be helpful to you. If you have any questions, please leave a message for me, the editor will reply to you in a timely manner. Thank you very much for your support for the help House website!