scrapy需要爬取链接中链接的内容,需要怎么处理?

0
def parse(self, response):
item = TencentItem()
for each in response.xpath('//tr[@class="even"] | //tr[@class="odd"]'):
item['Positionname'] = each.xpath('./td[1]/a/text()').extract()[0]
item['Detailslink'] = 'http://hr.tencent.com/' + each.xpath('./td[1]/a/@href').extract()[0]
item['Positioncategory'] = each.xpath('./td[2]/text()').extract()
item['peoplenumber'] = each.xpath('./td[3]/text()').extract()
item['Workingplace'] = each.xpath('./td[4]/text()').extract()
item['Releasetime'] = each.xpath('./td[5]/text()').extract()
已邀请:
0

一只写程序的猿 - 一个圣骑士成熟的标志是不再向盲人解释阳光。公众号:Python攻城狮 2018-01-18 回答

设置提取规则 对链接中新的链接进行内容采集   或者用yield返回新的链接再进行爬取
 核心处理规则: from scrapy.spiders import CrawlSpider, Rule
核心处理提取: from scrapy.linkextractors import LinkExtractor

要回复问题请先登录注册