我有一个蜘蛛刮页面,并获得所有的网址。
我有另一个蜘蛛,它得到了一个网址,并在它上废品。
我想为我从第一个spiner得到的每个链接调用第二个spiner。
从第一个spiner获取所有链接的代码
for site in sites:
Link = site.xpath('a/@href').extract()但我不知道如何为每个Link调用spiner
请帮帮忙
发布于 2014-01-15 03:06:09
我想你最好把这两个蜘蛛联合起来,这样做:
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
...https://stackoverflow.com/questions/21121357
复制相似问题