scrapy shell 可以用于测试xpath的响应

来源:互联网 发布:销售数据库管理系统 编辑:程序博客网 时间:2024/05/17 12:52

1. 安装Ipython

2. 在scrapy.cfg中设置 SCRAPY_PYTHON_SHELL

[settings]

shell = Ipython

3. scrapy shell <url>

4. shell 也可以用于本地文件 scrapy shell ./path/to/file.html

5. scrapy shell "http://scrapy.org" --nolog

6. response.xpath("//title/text()").extract_first()

原创粉丝点击