2024-09-28 22:33:10 发布
网友
我有一个尖刺刮网页,并获得所有的网址。在
我有另一个spiner,它有一个网址和废品。在
我想为第一个链接调用第二个spiner。在
从第一个spiner获取所有链接的代码
for site in sites: Link = site.xpath('a/@href').extract()
但我不知道如何为每个Link调用spiner
Link
请帮忙
我想你最好把这两个蜘蛛联合起来做些类似的事情:
def get_links(self, response): for site in sites: link = site.xpath('a/@href').extract()[0] yield Request(url=link, callback=self.scrape_them) def scrape_them(self, response): # by now scrapy called the link and you get the response ...
我想你最好把这两个蜘蛛联合起来做些类似的事情:
相关问题 更多 >
编程相关推荐