[scrapy] 2025-05-03 圈点952
摘要:scrapy最简单的在命令模式下测试抓取内容,示例。输入:scrapy shell http://www.xoxxoo.com
scrapy最简单的在命令模式下测试抓取内容,示例。
如果是在win系统中,先进入cmd,
然后输入:scrapy shell http://www.xoxxoo.com
shell命令即已经实例化了一个selector的对象sel,
再输入sel.xpath('//title') 获取了网页的标题。
如果输入sel.xpath('//a/@href')可以获得有a标签的href属性。
或者输入response.xpath("//h1/a/text()").extract()
...