![](/img/trans.png)
[英]XPath expression not working in scrapy spider but it is scrapy shell
[英]Scrapy request, shell Fetch() in spider
我正在尝试访问特定页面,我们称其为http://example.com/puppers
。 当直接使用scrapy shell
或标准scrapy.request
模块(结果为<405> HTTP
)连接时,无法访问此页面。
但是,当我先使用scrapy shell 'http://example.com/kittens'
,然后使用fetch('http://example.com/puppers')
它可以工作,并且我得到<200> OK HTTP
代码。 我现在可以使用scrapy shell
提取数据。
我试着在我的脚本实现这一点,通过改变referer
(使用URL#1),在user-agent
和其他几个人同时连接到puppers(URL#2)页面。 我仍然收到<405>代码。
我感谢所有的帮助。 谢谢。
start_urls = ['http://example.com/kittens']
def parse(self, response):
yield scrapy.Request(
url="http://example.com/puppers",
callback=self.parse_puppers
)
def parse_puppers(self, response):
#process your puppers
.....
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.