python爬虫 - python 登陆豆瓣?
天蓬老师
天蓬老师 2017-04-17 17:32:36
0
1
684

登陆豆瓣,发现要填写验证码,原来是想把验证码每次保存到本地手动填写,但是发现验证码的路劲一直在自动变化?如第一次是:https://www.douban.com/misc/captcha?id=t...
第二次变化为:https://www.douban.com/misc/captcha?id=q...,请问这种情况怎么办啊

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(1)
Peter_Zhu

So, you want to request a picture of the verification code yourself?

In fact, this change in URL is not called a change in the path, because id=tXP2X8xc0zBtyL1qUSgnBhbG:en&size=sThis section is the parameter carried by the request. That is:

{
id = "tXP2X8xc0zBtyL1qUSgnBhbG:en",
size = "s"
}

In fact, you can first request the login page, then parse the html or directly find the address of the verification code via regular expressions <img src="" >
Then request this image and store it locally.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!