parse_detail无法被调用
import scrapy
from test2.items import Test2Item
class Test3Spider(scrapy.Spider):
name = 'test3'
allowed_domains = ['www.jd.com']
start_urls = ['http://www.jd.com/']
def parse(self, response):
item = Test2Item()
data = response.xpath("//ul[@class=\"JS_navCtn cate_menu\"]/li")
for i in data:
item['name'] = i.xpath("./a/text()").extract_first()
item['link'] = response.urljoin(i.xpath("./a/@href").extract_first())
yield scrapy.Request(
url=item['link'],
callback=self.parse2,
meta={'item':'feeee'}
)
def parse2(self, response):
print(response.meta['item'])