scrapy框架之comand line tool
一 Global Command
1 startproject
https://docs.scrapy.org/en/latest/topics/commands.html#startproject
2 scrapy genspider -t basic baidu www.baidu.com
https://docs.scrapy.org/en/latest/topics/commands.html#genspider
3 settings
https://docs.scrapy.org/en/latest/topics/commands.html#settings
4 runspider
https://docs.scrapy.org/en/latest/topics/commands.html#runspider
5 shell
https://docs.scrapy.org/en/latest/topics/commands.html#shell
In []: response
Out[]: < https://www.baidu.com> In []: request
Out[]: <GET https://www.baidu.com> In []: view(response)
Out[]: True
6 fetch
https://docs.scrapy.org/en/latest/topics/commands.html#fetch
7view
https://docs.scrapy.org/en/latest/topics/commands.html#view
8 version
https://docs.scrapy.org/en/latest/topics/commands.html#version
二 Project-only Command
1 crawl
https://docs.scrapy.org/en/latest/topics/commands.html#crawl
2 check
https://docs.scrapy.org/en/latest/topics/commands.html#check
3 list
https://docs.scrapy.org/en/latest/topics/commands.html#list
4 edit(没啥用)
https://docs.scrapy.org/en/latest/topics/commands.html#edit
5 parse
https://docs.scrapy.org/en/latest/topics/commands.html#parse
6 bench
https://docs.scrapy.org/en/latest/topics/commands.html#bench
三 自定义命令
官方文档
https://docs.scrapy.org/en/latest/topics/commands.html#custom-project-commands
定义一个类,继承ScrapyCommand,实现run方法。
四 添加命令行参数
在命令行用crawl控制spider爬取的时候,加上-a选项,如
scrapy crawl WangyiSpider -a category=打车
然后在 spider 的构造函数里加上带入的参数:
import scrapy
class WangyiSpider(BaseSpider):
name = "Wangyi"
def __init__(self, category=None, *args, **kwargs):
super(WangyiSpider, self).__init__(*args, **kwargs)
scrapy框架之comand line tool的更多相关文章
- 安装scrapy框架的常见问题及其解决方法
		
下面小编讲一下自己在windows10安装及配置Scrapy中遇到的一些坑及其解决的方法,现在总结如下,希望对大家有所帮助. 常见问题一:pip版本需要升级 如果你的pip版本比较老,可能在安装的过程 ...
 - 爬虫基础(五)-----scrapy框架简介
		
---------------------------------------------------摆脱穷人思维 <五> :拓展自己的视野,适当做一些眼前''无用''的事情,防止进入只关 ...
 - python学习之-用scrapy框架来创建爬虫(spider)
		
scrapy简单说明 scrapy 为一个框架 框架和第三方库的区别: 库可以直接拿来就用, 框架是用来运行,自动帮助开发人员做很多的事,我们只需要填写逻辑就好 命令: 创建一个 项目 : cd 到需 ...
 - 5、爬虫系列之scrapy框架
		
一 scrapy框架简介 1 介绍 (1) 什么是Scrapy? Scrapy是一个为了爬取网站数据,提取结构性数据而编写的应用框架,非常出名,非常强悍.所谓的框架就是一个已经被集成了各种功能(高性能 ...
 - python 全栈开发,Day137(爬虫系列之第4章-scrapy框架)
		
一.scrapy框架简介 1. 介绍 Scrapy一个开源和协作的框架,其最初是为了页面抓取 (更确切来说, 网络抓取 )所设计的,使用它可以以快速.简单.可扩展的方式从网站中提取所需的数据.但目前S ...
 - scrapy框架中Item Pipeline用法
		
scrapy框架中item pipeline用法 当Item 在Spider中被收集之后,就会被传递到Item Pipeline中进行处理 每个item pipeline组件是实现了简单的方法的pyt ...
 - scrapy框架学习
		
一.初窥Scrapy Scrapy是一个为了爬取网站数据,提取结构性数据而编写的应用框架. 可以应用在包括数据挖掘,信息处理或存储历史数据等一系列的程序中. 其最初是为了 页面抓取 (更确切来说, 网 ...
 - python网络爬虫(1)——安装scrapy框架的常见问题及其解决方法
		
Scrapy是为了爬取网站数据而编写的一款应用框架,出名,强大.所谓的框架其实就是一个集成了相应的功能且具有很强通用性的项目模板. 其实在Linux和 Mac安装,就简单的pip命令即可: pip i ...
 - scrapy框架综合运用  爬取天气预报  + 定时任务
		
爬取目标网站: http://www.weather.com.cn/ 具体区域天气地址: http://www.weather.com.cn/weather1d/101280601.shtm(深圳) ...
 
随机推荐
- 仿天猫淘宝的ShopNC好商城原生Android 客户端源码项目
			
开发环境:Android Studio 2.0 | Gradle 2.0.0最后更新:2016-04-28 简介:基于好商城V4的Android客户端 目前已完成的功能(概述): 1.启动页 -> ...
 - com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
			
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure 长时间没连接mysql断开了, ...
 - [已解决]gitee初次使用git clone报错
			
本文描述的错误按实际出现先后顺序排列,并且附上一些其他可能会出现的问题 错误1: JZKJ@DESKTOP-I7Q9QJ4 MINGW64 ~ $ git clone https://gitee.co ...
 - Bootstrap历练实例:表单控件状态(禁用)
			
禁用的输入框 input 如果您想要禁用一个输入框 input,只需要简单地添加 disabled 属性,这不仅会禁用输入框,还会改变输入框的样式以及当鼠标的指针悬停在元素上时鼠标指针的样式. < ...
 - 如何查看 JAR 包的源代码
			
ava 项目的编译文件经常被打包成 JAR(Java Archive,Java 归档文件)文件,当然,作为学习,有时候也非常想看到这个 JAR 被打包前的源代码是怎么样的. 下面提供几种查看 JAR ...
 - java在线聊天项目1.3版 ——设计好友列表框功能
			
设计好友列表框功能,思路—— 1.当客户端成功登陆后,则客户端把成功登陆信息发送给服务端, 2.由服务端将接收到来自各个成功登陆的客户端的用户信息添加进好友列表, 3.每当有成功登陆的用户就向各个客户 ...
 - 牛客网NOIP赛前集训营-提高组(第三场)A 管道维修
			
https://www.nowcoder.com/acm/contest/174/A 这个的话 一个位置被清理的时间就是它到空白格子/边界的最短路对吧qww 然后求期望的话 假设它在第i步被清理掉的 ...
 - scrollTop如何实现click后页面过渡滚动到顶部
			
用JS操作,body元素的scrollTop var getTop = document.getElementById("get-top"); var head = documen ...
 - struct 区别 在C 和C++ 中
			
C语言中: Struct是用户自定义数据类型(UDT). C++语言中: Struct是抽象数据类型(ADT),支持成员函数的定义. 在C++中,struct的成员的默认访问说 ...
 - Python的第3堂课
			
20181119笔记 一.内存管理相关 ①Cpython解释器的垃圾回收机制 什么是垃圾:当一个值没有被绑定任何变量名(即该值的引用计数为零时),该值就是垃圾. 垃圾回收是收回值占用的内存空间. 引用 ...