xchaoinfo / fuck-login

模拟登录一些知名的网站,为了方便爬取需要登录的网站
5.86k stars 2.02k forks source link

拉勾网的登录,出现“请勿重复提交,刷新页面后重试” #88

Open laichilueng opened 7 years ago

laichilueng commented 7 years ago

X_Anti_Forge_Token以及X_Anti_Forge_Code这两个防爬虫code能获取到,但是结果是“请勿重复提交,刷新页面后重试”。本人刚学爬虫不久,分析不出具体原因,希望能给予一些帮助,衷心感谢。

laichilueng commented 6 years ago

这个问题,好像是Request的异步导致的,换成requests去get就没问题了。可参考https://github.com/laichilueng/lagou_login/blob/master/lagou_login.py 爬虫前先登录然后调用get_cookies()便能获取到登陆后的cookie

GhostClock commented 6 years ago

其实有个最最简单的方法 filebug里面的请求头里面复制cookie到setting文件里

DEFAULT_REQUEST_HEADERS = {
  'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  'Accept-Language': 'en',
  'Host': 'www.lagou.com',
  'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.104 Safari/537.36',
  'Referer': 'https://www.lagou.com/',
  'Cookie': "" #填写请求头里面复制cookie值
}

但是这个cookie有一个时间限制,能解决当前问题

Axierty commented 6 years ago

你把header头写成一模一样就没问题了

tywei90 commented 5 years ago

解决了吗?