chrome抓取网页插件(爬取这些数据需要哪些工具?一句代码都不用写!)
优采云 发布时间: 2022-01-12 17:10chrome抓取网页插件(爬取这些数据需要哪些工具?一句代码都不用写!)
在做电商的时候,消费者对产品的评论很重要,但是如果他们不知道怎么写代码呢?这是一个无需编写任何代码即可进行简单数据爬取的 Chrome 插件。下面显示了一些捕获的数据:
可以看到,爬取的地址、评论者、评论内容、时间、商品颜色都已经被抓取。那么,抓取这些数据需要哪些工具呢?只有两个:
1. Chrome 浏览器;
2. 插件:网络爬虫
插件下载地址:
最后,如果你想自己抢,这里是这个抢的详细过程:
1.首先复制下面的代码,是的,你不需要写代码,但是要上手,还是需要复制代码,以后可以自己自定义选择,不用写代码.
{ "_id": "jdreview", "startUrl": [ "https://item.jd.com/100000680365.html#comment" ], "selectors": [ { "id": "user", "type": "SelectorText", "selector": "div.user-info", "parentSelectors": [ "main" ], "multiple": false, "regex": "", "delay": 0 }, { "id": "comments", "type": "SelectorText", "selector": "div.comment-column > p.comment-con", "parentSelectors": [ "main" ], "multiple": false, "regex": "", "delay": 0 }, { "id": "time", "type": "SelectorText", "selector": "div.comment-message:nth-of-type(5) span:nth-of-type(4), div.order-info span:nth-of-type(4)", "parentSelectors": [ "main" ], "multiple": false, "regex": "", "delay": "0" }, { "id": "color", "type": "SelectorText", "selector": "div.order-info span:nth-of-type(1)", "parentSelectors": [ "main" ], "multiple": false, "regex": "", "delay": 0 }, { "id": "main", "type": "SelectorElementClick", "selector": "div.comment-item", "parentSelectors": [ "_root" ], "multiple": true, "delay": "10000", "clickElementSelector": "div.com-table-footer a.ui-pager-next", "clickType": "clickMore", "discardInitialElements": false, "clickElementUniquenessType": "uniqueHTMLText" } ] }
2. 然后打开chrome浏览器,在任意页面同时按下Ctrl+Shift+i,在弹窗中找到Web Scraper,如下:
3. 如下
4. 如图,粘贴上面的代码:
5. 如图所示,如果
来源 gaodai.ma#com 搞#code!码网
如果需要自定义URL,注意替换。URL 后面的#comment 是评论的直接链接,不能删除:
6. 如图:
7. 如图:
8. 如图,点击抓取后,会自动打开需要抓取的页面,不要关闭窗口,等待完成。
9. 最后,点击下载到计算机并保存数据。
使用此工具的好处是:
1. 无需编程;
2.京东的评论基本可以用这个脚本,修改对应的url即可;
3.如果要抓取的评论少于1000条,这个工具会很方便,所有数据都会自动下载;
使用注意事项:
1. 已经抓取过一次的数据会被记录下来,如果立即再次抓取则不会保存。建议关闭浏览器重新打开再试一次;
2. 爬取次数:1000以内没有问题,可能是京东直接根据IP屏蔽了更多的爬取;
如果你的英文水平不错,可以尝试阅读官方文档进一步学习和定制自己的爬虫。
官方教程:
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持高代马搞码网。