Python如何使用Chrome插件實(shí)現(xiàn)爬蟲-創(chuàng)新互聯(lián)

小編這次要給大家分享的是Python如何使用Chrome插件實(shí)現(xiàn)爬蟲,文章內(nèi)容豐富,感興趣的小伙伴可以來了解一下,希望大家閱讀完這篇文章之后能夠有所收獲。

成都創(chuàng)新互聯(lián)公司專業(yè)為企業(yè)提供建華網(wǎng)站建設(shè)、建華做網(wǎng)站、建華網(wǎng)站設(shè)計、建華網(wǎng)站制作等企業(yè)網(wǎng)站建設(shè)、網(wǎng)頁設(shè)計與制作、建華企業(yè)網(wǎng)站模板建站服務(wù),十多年建華做網(wǎng)站經(jīng)驗(yàn),不只是建網(wǎng)站,更提供有價值的思路和整體網(wǎng)絡(luò)服務(wù)。

做電商時,消費(fèi)者對商品的評論是很重要的,但是不會寫代碼怎么辦?這里有個Chrome插件可以做到簡單的數(shù)據(jù)爬取,一句代碼都不用寫。下面給大家展示部分抓取后的數(shù)據(jù):

Python如何使用Chrome插件實(shí)現(xiàn)爬蟲

可以看到,抓取的地址,評論人,評論內(nèi)容,時間,產(chǎn)品顏色都已經(jīng)抓取下來了。那么,爬取這些數(shù)據(jù)需要哪些工具呢?就兩個:

1. Chrome瀏覽器;

2. 插件:Web Scraper

插件下載地址:https://chromecj.com/productivity/2018-05/942.html

最后,如果你想自己動手抓取一下,這里是這次抓取的詳細(xì)過程:

1. 首先,復(fù)制如下的代碼,對,你不需要寫代碼,但是為了便于上手,復(fù)制代碼還是需要的,后續(xù)可以自己定制和選擇,不需要寫代碼。

{
  "_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"
    }
  ]
}

分享標(biāo)題:Python如何使用Chrome插件實(shí)現(xiàn)爬蟲-創(chuàng)新互聯(lián)
網(wǎng)頁鏈接:http://www.muchs.cn/article12/deopdc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供商城網(wǎng)站、網(wǎng)站建設(shè)、外貿(mào)網(wǎng)站建設(shè)、靜態(tài)網(wǎng)站、微信小程序、搜索引擎優(yōu)化

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都seo排名網(wǎng)站優(yōu)化