2018-12-16

pip install ansible

def get_id():这个函数用于找到登陆时候的验证码,以及匹配data里面的captcha-id url = 'https://accounts.douban.com/login?' data = requests.get(url).content selector = lxml.html.document_fromstring(data) id = selector.xpath('//input[@name="captcha-id"]/ @value') image_url=selector.xpath('//img[@id="captcha_image"]/@src')这里是下载验证码图片 print(id, image_url) with open('login.png','wb')as f: 

你可能感兴趣的:(2018-12-16)