zhihu.py 文件源码

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

项目:Charlotte 作者: LiZoRN 项目源码 文件源码
def login_after_captcha(self, response):
        with open("captcha.jpg", "wb") as f:
            f.write(response.body)
            f.close()

        from PIL import Image
        try:
            im = Image.open('captcha.jpg')
            im.show()
            im.close()
        except:
            pass

        captcha = input("?????\n>")

        post_data = response.meta.get("post_data", {})
        post_url = "https://www.zhihu.com/login/phone_num"
        post_data["captcha"] = captcha
        return [scrapy.FormRequest(
            url=post_url,
            formdata=post_data,
            headers=self.headers,
            callback=self.check_login
        )]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号