Home  >  Q&A  >  body text

python爬虫 - python 登陆豆瓣?

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

天蓬老师天蓬老师2714 days ago656

reply all(1)I'll reply

  • 天蓬老师

    天蓬老师2017-04-17 17:34:36

    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.

    reply
    0
  • Cancelreply