我跑在Hostelworld.com以下scrapy蜘蛛,檢索:Scrapy歸國NotImplementedError
- 大陸,在第一頁上發展中國家和網址
的從一個給定的城市名單運行它的時候,我無法找到一個SOLUT已經遵循了國家URL
def parse_page1(self, response): for sel in response.xpath('//li[@class="accordion-navigation"]//ul[@class="small-block-grid-2 medium-block-grid-4 large-block-grid-6"]/li'): item = HostelWorldItem() item['continent'] = sel.xpath('./../../@id').extract_first() item['country'] = sel.xpath('./a/text()').extract_first() item['country_url'] = sel.xpath('./a/@href').extract_first() yield item url = response.urljoin('%s'%(item['country_url'])) request = scrapy.Request(url, callback=self.parse_dir_contents) request.meta['item'] = item yield request def parse_dir_contents(self, response): item = response.meta['item'] item['city'] = response.xpath('//div[@class="otherlocations"]/li/a/text()').extract_first() yield item
我收到以下錯誤後國家離子到:
scrapy/spiders/__init__.py", line 76, in parse
raise NotImplementedError
NotImplementedError
非常感謝您的幫助!