#Windows平台 一、pip3 install wheel 三、pip3 install lxml 四、pip3 install pyopenssl 五、pip3 install pywin32 #若是不行去官网https://sourceforge.net/projects/pywin32/files/pywin32/ 六、pip3 install twisted #若是不行去官网:http://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted 七、pip3 install scrapy #Linux平台 一、pip3 install scrapy
#1 查看帮助 scrapy -h scrapy <command> -h #2 有两种命令:其中Project-only必须切到项目文件夹下才能执行,而Global的命令则不须要 Global commands: startproject #建立项目 genspider #基本上都要cd项目目录,scrapy genspider 名称 url settings #若是是在项目目录下,则获得的是该项目的配置 runspider #运行一个独立的python文件,没必要建立项目 shell #scrapy shell url地址 在交互式调试,如选择器规则正确与否 fetch #独立于程单纯地爬取一个页面,能够拿到请求头 view #下载完毕后直接弹出浏览器,以此能够分辨出哪些数据是ajax请求 version #scrapy version 查看scrapy的版本,scrapy version -v查看scrapy依赖库的版本 Project-only commands: crawl #运行爬虫,必须建立项目才行,确保配置文件中ROBOTSTXT_OBEY = False check #检测项目中有无语法错误 list #列出项目中所包含的爬虫名 edit #编辑器,通常不用 parse #scrapy parse url地址 --callback 回调函数 #以此能够验证咱们的回调函数是否正确 bench #scrapy bentch压力测试 #3 官网连接 https://docs.scrapy.org/en/latest/topics/commands.html
crawl
运行爬虫程序若是不打印日志html
scrapy crawl 爬虫程序中的name --nolog
python