def login(self, response):
captcha = "captcha.jpg"
with open(captcha, "wb") as f:
f.write(response.body)
try:
Image.open(captcha).show()
except:
pass
post_data = response.meta.get("post_data", {})
post_url = "https://www.zhihu.com/login/{}".format(self.user_type)
post_data["captcha"] = input("Please input the captcha: ")
return [scrapy.FormRequest(
url=post_url,
formdata=post_data,
headers=self.headers,
callback=self.check_login
)]
# ???????????start_urls??url??parse?????????
评论列表
文章目录