zhihu.py 文件源码

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

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

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

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


问题


面经


文章

微信
公众号

扫码关注公众号