Git Product home page Git Product logo

dianping_spider's People

Contributors

achernar0208 avatar chenzixinn avatar dlut-nemo avatar halsn avatar sniper970119 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dianping_spider's Issues

cookie失效非常快,大佬有什么建议没?

WARNING: cookie失效或者被限制访问,更新cookie或登录大众点评滑动验证

我设置的:

累计请求多少次休息多少秒,从小到大排列。例:1,2;5,10 代表每请求1次休息2秒,每5次休息10秒。

requests_times = 1,5;3,20;10,80

提示验证码

复制 url 去浏览器验证,依然出错。去终端继续按下回车依然没办法继续爬虫。只能获取店铺的第一页评论。

A 关于处理验证码,按任意键回车后继续问题

使用了隧道代理,去掉了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,但是我即不知道这到底有没有用,也不知道具体加在哪。

关于评论页被ban的问题

我反复用了4个不同的账号,出现评论页被ban的速度越来越快,最后两个账号发出不到10个评论页请求即被ban。
整个过程中有使用代理,requests_times参数设置为1,3;5,17;10,40

接口并发处理

首先感谢作者的开源代码,对我有很大帮助~
我有个疑问:代码在获取酒店详细信息时已经解密接口,且接口请求不需要cookie,那么为什么不考虑使用多线程或者协程来进行接口请求呢?这样一方面可以加快速度,另一方面也节约了代理的成本(代理一般都支持多并发)。是因为有其他限制吗?

接口代理

大佬怎么快速爬取呀,用接口的话,好像爬取不到详细地址啥的,要爬取详细页面的数据好像只能用cookie,而且速度也不快。用代理➕cookie效果也不太好。

关于tcv、uuid 的一些使用信息

  • uuid,在不用 cookie 的 场合下使用的时候,可以直接随机生成;

  • 出验证码的情况下,原uuid+新ip不一定能过验证码,还是返回验证码;随机uuid+新的ip可以请求成功;

  • 但是,在有 cookie 场合 下随机 uuid 还没测试,因为封号限制太严格,没有进行测试;

  • tcv 是否可以随机生成,还在测试中;

A系统中可能没有安装或启动MongoDB数据库

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不是很熟。。。

请教下复现时几个问题

主要是复现是卡在了这步
image

想请教下config.ini设置有没有问题

1、没有找到tcv 和uuid,使用的是默认值
主要是抓包的时候没有找到相应的allReview或者basicHiddenInfo的请求连接

2、mongdb设置为:mongo_path = mongodb://127.0.0.1:27017
运行时启动了mongod,能正常打开127.0.0.1:27017,如下图所示
image

但是是初次使用,不确定mongdb是否设置成功?
另外商家搜索结果展示的图,请问是用什么软件看的?
image

3、keyword默认写的火锅,请问可以置空值吗?

random.shuffle 错误

感谢作者的作品。使用的时候发现一个BUG:
utils/cookie_utils.py 第117行:

self.all_cookie=random.shuffle(self.all_cookie)

random.shuffle直接打乱传入的列表,返回会返回一个None,会把self.all_cookie变为None导致下方代码出错。

现在还能爬吗?

搜索页数: 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)

关于tcv、uuid 的一些使用信息

关于tcv、uuid 的一些使用信息

  • uuid,在不用 cookie 的 场合下使用的时候,可以直接随机生成;

  • 出验证码的情况下,原uuid+新ip不一定能过验证码,还是返回验证码;随机uuid+新的ip可以请求成功;

  • 但是,在有 cookie 场合 下随机 uuid 还没测试,因为封号限制太严格,没有进行测试;

  • tcv 是否可以随机生成,还在测试中;

使用代理报错

image
您好,请问我不使用代理的时候店铺信息可以获得 评论获取直接被ban了 于是就想买代理来尝试 但是用代理后报错
请问代理是这样设置的吗
image

location problem

Shanghai location number is 0
but what about other city, Like Mocao, Hongkong
can u tell me how to find it?

直接输入链接search_url似乎不能运行,只能通过keyword, location_id,channel_id这种方式

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'

Search pag_nub

大佬,怎么增加一个缓冲区,有时候爬数据提示cookie失效,替换了也不行,只能结束重新爬,不想从头开始,想继续刚才的断点位置。

关于cookie

大佬我想问一下那个大众点评浏览器上的cookie能够直接使用吗,我把cookie复制到我的headers中,好像还是不能够获取第二页以后的网页内容

推荐菜数据为空

image

按照教程配置后,抓取顺利,数据准确,但是推荐菜字段为空,跪求大佬看看~

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.