zhihu.py 文件源码

python
阅读 33 收藏 0 点赞 0 评论 0

项目:FirstSpider 作者: yipwinghong 项目源码 文件源码
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?????????
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号