無需編程的爬蟲 - 爬取京東的評論
- 2020 年 4 月 22 日
- 筆記
【原創】轉載請註明作者Johnthegreat和本文鏈接
做電商時,消費者對商品的評論是很重要的,但是不會寫程式碼怎麼辦?這裡有個Chrome插件可以做到簡單的數據爬取,一句程式碼都不用寫。下面給大家展示部分抓取後的數據:
可以看到,抓取的地址,評論人,評論內容,時間,產品顏色都已經抓取下來了。那麼,爬取這些數據需要哪些工具呢?就兩個:
1. Chrome瀏覽器;
2. 插件:Web Scraper
插件下載地址://chromecj.com/productivity/2018-05/942.html
最後,如果你想自己動手抓取一下,這裡是這次抓取的詳細過程:
1. 首先,複製如下的程式碼,對,你不需要寫程式碼,但是為了便於上手,複製程式碼還是需要的,後續可以自己訂製和選擇,不需要寫程式碼。
{
"_id": "jdreview",
"startUrl": [
"//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"
}
]
}
如果使用中發現問題,歡迎評論區交流,當然,如果你的英語水平不錯,可以嘗試閱讀官方文檔,進一步學習和訂製自己的爬蟲。
官方教程://www.webscraper.io/documentation










