def login():
proxy = get_proxy().get("proxy")
url = 'https://accounts.douban.com/j/mobile/login/basic'
data = {
'ck': '',
'name': '',#用户名,必须
'password': '',#密码,必须
'remember': 'false',
'ticket': '',
}
html = s.post(url, headers=headers, data=data)
print(html)
a = json.loads(html.text)
print(a)
message = a['message']
if message == 'captcha_required':
captcha_image_url = a['payload']['captcha_image_url']
captcha_id = a['payload']['captcha_id']
#把网址复制到网页,手动输入验证码
captcha = input("输入验证码")
data['captcha_solution'] = captcha
data['captcha_id'] = captcha_id
html = s.post(url, headers = headers, data=data, proxies={"http": "http://{}".format(proxy)})
if message == 'Access denied' :
print("Access denied, try later")
proxy不是必要的,下次更新