本帖最后由 追影 于 2023-6-30 11:15 编辑
http://www.manongjc.com/detail/50-mqbkcaqdoaqsnrp.html - def parse(self, response):
- for sel in response.xpath('//li[@class="clearfix"]/div[@class="list_con"]'):
- item=DmozItem()
- item['href']=sel.xpath('h2/a/@href').extract()[0]
- request= scrapy.Request(item['href'], callback=others_parse,dont_filter=True)
- request.meta['item'] = item
- yield request
- def others_parse(self, response):
- item = response.meta['item']
- item['other_url'] = response.url
- yield item
复制代码
|