目录
<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 系列 手札
本文作者:陈景峯
转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。