sniper970119 / dianping_spider Goto Github PK
View Code? Open in Web Editor NEW大众点评爬虫(全站可爬,解决动态字体加密,非OCR)。持续更新
License: GNU General Public License v3.0
大众点评爬虫(全站可爬,解决动态字体加密,非OCR)。持续更新
License: GNU General Public License v3.0
py[line:54] - WARNING: cookie失效或者被限制访问,更新cookie或登录大众点评滑动验证
请问商家店铺的星级怎么爬取到
WARNING: cookie失效或者被限制访问,更新cookie或登录大众点评滑动验证
我设置的:
requests_times = 1,5;3,20;10,80
复制 url 去浏览器验证,依然出错。去终端继续按下回车依然没办法继续爬虫。只能获取店铺的第一页评论。
使用了隧道代理,去掉了cookie,还是会出现验证码的情况,而且好像没法手动解决,可以麻烦作者帮忙看一下是什么问题吗?
[config]
use_cookie_pool = False
Cookie:
uuid : rth430b2-d52a-2550-a522-ebaebbf4ca16.164xxxxxxxx
tcv = 0x0xrqxxxx
user-agent = Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:87.0) Gecko/20100101 Firefox/87.0
save_mode = mongo
mongo_path = mongodb://localhost
requests_times = 1,2;3,5;10,50
[detail]
keyword = 美食
location_id = 4
channel_id =
search_url =
need_first = False
need_pages = 10
[proxy]
use_proxy = True
repeat_nub = 5
http_extract = False
key_extract = True
http_link =
proxy_host = http-short.xxxxxx.com
proxy_port = 100xx
key_id = 8301678xxxxxxxxxxxx
key_key = yJDxxxxx
大大,我爬取的数据中有一些地方值为空,比如店铺地址这些,请问这是为什么
首先非常感谢您这个项目的帮助!
我需要遍历某地区所有银行网点,以及其评论信息。部分银行无评论信息,程序会报错终止,我尝试修改review.py
,将这部分的循环reviews = html.select('.reviews-items')[0].select('.main-review')
,添加try
结构。这样以来缺失不会报错终止,但是数据库中不会写入这些无评论的银行数据。
非常期待得到您的答复
介于本人数次运行项目失败的经历,发现找一个靠谱便宜的代理服务十分困难,每次一运行就被ban了,所以我将作者的代码翻译成了油猴脚本,为不需要爬虫但是需要手动复制一些评论的人士使用,地址 https://greasyfork.org/scripts/435145
A
大佬你好,运行之后显示“处理验证码,按任意键回车后继续”,打开后面跟着的链接能进入验证滑块界面,但是滑动之后就出现“请求异常,拒绝操作”。正常用浏览器打开网页是不会报错的。浏览器是新下载的,应该不存在需要清除cookie,也尝试了注释掉detail、review和search三个文件的加密(注释了获取加密文件、替换加密文件这两行,不知道注释对了没有),但是一样报错。我按了f12之后看到有个415错误,搜到一个解决办法是加一个contentType,但是我即不知道这到底有没有用,也不知道具体加在哪。
开发者你好,如果我要搜索西安的数据,城市代号应该填什么?
rt
我反复用了4个不同的账号,出现评论页被ban的速度越来越快,最后两个账号发出不到10个评论页请求即被ban。
整个过程中有使用代理,requests_times参数设置为1,3;5,17;10,40
首先感谢作者的开源代码,对我有很大帮助~
我有个疑问:代码在获取酒店详细信息时已经解密接口,且接口请求不需要cookie,那么为什么不考虑使用多线程或者协程来进行接口请求呢?这样一方面可以加快速度,另一方面也节约了代理的成本(代理一般都支持多并发)。是因为有其他限制吗?
get_basic_review 获取基本评论的接口现在好像失效了
大佬怎么快速爬取呀,用接口的话,好像爬取不到详细地址啥的,要爬取详细页面的数据好像只能用cookie,而且速度也不快。用代理➕cookie效果也不太好。
uuid,在不用 cookie 的 场合下使用的时候,可以直接随机生成;
出验证码的情况下,原uuid+新ip不一定能过验证码,还是返回验证码;随机uuid+新的ip可以请求成功;
但是,在有 cookie 场合 下随机 uuid 还没测试,因为封号限制太严格,没有进行测试;
tcv 是否可以随机生成,还在测试中;
A开发者你好,我跑main的时候报这个错. (WARNING: 系统中可能没有安装或启动MongoDB数据库,请先根据系统环境安装或启动MongoDB,再运行程序)
目前访问http://127.0.0.1:27017/会提示It looks like you are trying to access MongoDB over HTTP on the native driver port.
用的是anaconda prompt跑的,没有动过config.ini。mongoDB用的5.0。
能帮我想想是哪里出了问题吗? 谢谢,我mongoDB不是很熟。。。
rt,可否提供下保存csv的选项以及相应的path如何写
执行main.py 报错:ValueError: check_hostname requires server_hostname
感谢作者的作品。使用的时候发现一个BUG:
utils/cookie_utils.py
第117行:
self.all_cookie=random.shuffle(self.all_cookie)
random.shuffle直接打乱传入的列表,返回会返回一个None,会把self.all_cookie变为None导致下方代码出错。
anthor question: do you have review data? if so , i can contact you.
杭州对应的location id是多少?
搜索页数: 0%| | 0/5 [00:00<?, ?it/s]
详细爬取: 0%| | 0/15 [00:00<?, ?it/s]2021-05-28 14:26:17,472 - 4692-MainThread - G:\D11\dianping_spider\function\get_encryption_requests.py[line:108] - WARNING: 代理质量较低
详细爬取: 0%| | 0/15 [00:00<?, ?it/s]
搜索页数: 0%| | 0/5 [00:01<?, ?it/s]
感觉配置成功了,但是提示这个
if not only_need_first and needed_pages is None:
url = 'http://www.dianping.com/search/keyword/' + str(self.location_id) + '/' + str(
self.channel_id) + '_' + str(key_word) + '/p' + str(1)
if self.custom_search_url != '':
url = self.custom_search_url + str(1)
r = requests_util.get_requests(url)
text = r.text
html = BeautifulSoup(text, 'lxml')
pages = len(html.select('.PageLink'))
if pages == 0:
needed_pages = 1
else:
needed_pages = int(html.select('.PageLink')[pages - 1].text.strip()))
print("长度为", needed_pages)
uuid,在不用 cookie 的 场合下使用的时候,可以直接随机生成;
出验证码的情况下,原uuid+新ip不一定能过验证码,还是返回验证码;随机uuid+新的ip可以请求成功;
但是,在有 cookie 场合 下随机 uuid 还没测试,因为封号限制太严格,没有进行测试;
tcv 是否可以随机生成,还在测试中;
感谢开发者大佬!
提示如title,是我这边配置有什么问题吗,或者是因为海外IP?
也更改过那个时间,但是好像没什么用。。。
如题。
值此辞旧迎新之际,祝老板新年快乐,万事如意,工作顺利,在update上也能速战速决!
详情页请求被ban,程序继续运行
Shanghai location number is 0
but what about other city, Like Mocao, Hongkong
can u tell me how to find it?
rt, config里说填写search_url会默认以上参数无效,这个功能似乎并没有实现
Traceback (most recent call last):
File "/home/geolab/anaconda3/lib/python3.7/configparser.py", line 788, in get
value = d[option]
File "/home/geolab/anaconda3/lib/python3.7/collections/init.py", line 916, in getitem
return self.missing(key) # support subclasses that define missing
File "/home/geolab/anaconda3/lib/python3.7/collections/init.py", line 908, in missing
raise KeyError(key)
KeyError: 'keyword'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "main.py", line 27, in
keyword = global_config.getRaw('detail', 'keyword')
File "/home/geolab/dianping_spider/utils/config.py", line 42, in getRaw
return self._configRaw.get(section, name)
File "/home/geolab/anaconda3/lib/python3.7/configparser.py", line 791, in get
raise NoOptionError(option, section)
configparser.NoOptionError: No option 'keyword' in section: 'detail'
A我复制这个链接到浏览器后滑动验证都在网页上报错:请求异常,拒绝操作。
试过chrome edge 和 IE,间隔24小时, 都是这个情况。
是不是跟我在国外有原因。。。
大佬,怎么增加一个缓冲区,有时候爬数据提示cookie失效,替换了也不行,只能结束重新爬,不想从头开始,想继续刚才的断点位置。
大佬我想问一下那个大众点评浏览器上的cookie能够直接使用吗,我把cookie复制到我的headers中,好像还是不能够获取第二页以后的网页内容
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.