Python 3.x Scrapy:如何传递链接

Python 3.x Scrapy:如何传递链接,python-3.x,web-scraping,scrapy,Python 3.x,Web Scraping,Scrapy,我不能传递推荐信。启动蜘蛛时,我没有获取数据 代码帮助 我是学刮痧的初学者 import scrapy 从movie.items导入AfishaCinema AfishaCinemaSpider类(羊瘙痒蜘蛛): 名称='afisha电影院' 允许的_域=['kinopoik.ru'] 起始URL=['https://www.kinopoisk.ru/premiere/ru/'] def解析(自我,响应): links=response.css('div.textBlock>span.name\

我不能传递推荐信。启动蜘蛛时,我没有获取数据 代码帮助

我是学刮痧的初学者

import scrapy
从movie.items导入AfishaCinema
AfishaCinemaSpider类(羊瘙痒蜘蛛):
名称='afisha电影院'
允许的_域=['kinopoik.ru']
起始URL=['https://www.kinopoisk.ru/premiere/ru/']
def解析(自我,响应):
links=response.css('div.textBlock>span.name\u big>a').xpath(
“@href').extract()
对于链接中的链接:
生成scrapy.Request(link,callback=self.parse_moov,
dont_filter=True)
def parse_moov(自我,响应):
项目=AfishaCinema()
item['name']=response.css('h1.moviename big::text').extract()

您没有获得数据的原因是您没有从
parse\u moov
方法中产生任何数据。根据,parse方法必须返回
请求
和/或dicts或
对象的iterable。所以加上

parse_moov
方法的末尾

另外,为了能够运行您的代码,我必须修改

yield scrapy.Request(link, callback=self.parse_moov, dont_filter=True)

parse
方法中,否则我会出现错误:

ValueError: Missing scheme in request url: /film/monstry-na-kanikulakh-3-more-zovyot-2018-950968/

(这是因为
Request
constructor需要绝对URL,而页面包含相对URL。)

您没有获得数据的原因是您没有
parse\u moov
方法中产生任何
。根据,parse方法必须返回
请求
和/或dicts或
对象的iterable。所以加上

parse_moov
方法的末尾

另外,为了能够运行您的代码,我必须修改

yield scrapy.Request(link, callback=self.parse_moov, dont_filter=True)

parse
方法中,否则我会出现错误:

ValueError: Missing scheme in request url: /film/monstry-na-kanikulakh-3-more-zovyot-2018-950968/
(这是因为
Request
constructor需要绝对URL,而页面包含相对URL。)