爬取拉钩踩过的坑

1. success': False, 'msg': '您操作太频繁,请稍后再访问'

解决方法: 需要完善header头,服务器会基于一些信息来处理和反馈,header头信息不足,导致服务器拒绝

header = {'Cookie':'xxxx', 'User-Agent':'xxxx', 'Referer':'xxxx'}

2. Caused by ProxyError('Cannot connect to proxy.'

链接 : python requests proxies 错误

免费代理网址 : 点击打开链接

格式如下: 如标明是https,需改为https,然后使用requests.get(url, header=header, proxie = proxie)即可传入并使用ip地址

proxie = {
    'http': 'http://61.135.217.7:80',
}

3. 抓取ajax异步加载数据的两种方法:

    1. selenium + phantomJS

    2. 抓取json数据,用json.loads解析


猜你喜欢

转载自blog.csdn.net/qq_18525247/article/details/80337905