目錄
<dl></dl>
<dt>11.1. 安裝 scrapy 開發環境</dt>
<dd><dl></dl></dd>
<dt>11.1.1. Mac</dt>
<dt>11.1.2. Ubuntu</dt>
<dt>11.1.3. 使用 pip 安裝 scrapy</dt>
<dt>11.1.4. 測試 scrapy</dt>
<dt>11.2. scrapy 指令</dt>
<dt>11.2.1. </dt>
<dt>11.2.2. 建立 spider</dt>
<dt>11.2.3. 列出可用的 spiders</dt>
<dt>11.2.4. 運作 spider</dt>
<dt>11.3. Scrapy Shell</dt>
<dt>11.3.1. response</dt>
<dt>11.3.1.1. 目前URL位址</dt>
<dt>11.3.1.2. status HTTP 狀态</dt>
<dt>11.3.1.3. text 正文</dt>
<dt>11.3.1.4. css</dt>
<dd><dl><dt>11.3.1.4.1. 擷取 html 屬性</dt></dl></dd>
<dt>11.3.1.5. xpath</dt>
<dt>11.3.1.6. headers</dt>
<dt>11.4. 爬蟲項目</dt>
<dt>11.4.1. 建立項目</dt>
<dt>11.4.2. Spider</dt>
<dt>11.4.2.1. 翻頁操作</dt>
<dt>11.4.2.2. 采集内容儲存到檔案</dt>
<dt>11.4.3. settings.py 爬蟲配置檔案</dt>
<dd><dl><dt>11.4.3.1. 忽略 robots.txt 規則</dt></dl></dd>
<dt>11.4.4. Item</dt>
<dt>11.4.5. Pipeline</dt>
<dt>11.5. 下載下傳圖檔</dt>
<dt>11.5.1. 配置 settings.py</dt>
<dt>11.5.2. 修改 pipelines.py 檔案</dt>
<dt>11.5.3. 編輯 items.py</dt>
<dt>11.5.4. Spider 爬蟲檔案</dt>
<dt>11.6. xpath</dt>
<dt>11.6.1. 邏輯運算符</dt>
<dt>11.6.1.1. and</dt>
<dt>11.6.1.2. or</dt>
<dt>11.6.2. function</dt>
<dt>11.6.2.1. text()</dt>
<dt>11.6.2.2. contains()</dt>
https://scrapy.org
搜尋 scrapy 包,scrapy 支援 Python2.7 和 Python3 我們隻需要 python3 版本
Ubuntu 17.04 預設 scrapy 版本為 1.3.0-1 如果需要最新的 1.4.0 請使用 pip 指令安裝
安裝 scrapy
輸入大寫 “Y” 然後回車
建立測試程式,用于驗證 scrapy 安裝是否存在問題。
運作爬蟲
原文出處:Netkiller 系列 手劄
本文作者:陳景峯
轉載請與作者聯系,同時請務必标明文章原始出處和作者資訊及本聲明。