环境:
macOS/Linux
python 3.7.3
scrapy 2.4
前言:
在阅读本博客之前您如果您没有掌握Xpath、Urllib2知识,您应该先阅读相关内容。
sracpy
在写scrapy之前,先吐槽一波scrapy的中文文档,国内一共有两个版本:0.26与1.5,而scrapy已经更新到2.4…对于英语不好的人来说阅读英文文档确实是一个难点。
本节分为四个小点
安装
我使用的是linux系统下的软件包直接安装的
pip3 install scrapy
安装过程可能报的错,解决方案:
解决Could not find a version that satisfies the requirement Twisted>=13.1.0 (from Scrapy): link.
解决You are using pip version 9.0.1, however version 18.0 is available. You should consider upgrading: link.
解决import twisted.persisted.styles # NOQA ModuleNotFoundError: No module named ‘twisted.persisted’ : link.
无身份验证爬取
简单搭建scrapy
#到达爬虫所在文件夹
cd ...