def parse(self, response):
item=AutopjtItem()
#?Xpath????????
item["name"]=response.xpath("//a[@class='pic']/@title").extract()
item["price"]=response.xpath("//span[@class='price_n']/text()").extract()
item["link"]=response.xpath("//a[@class='pic']/@href").extract()
item["comnum"]=response.xpath("//a[@name='P_pl']/text()").extract()
#???item
yield item
#??????75?
for i in range(1,76):
#???????
url="http://category.dangdang.com/pg"+str(i)+"-cid4002203.html"
#?yieldRequest??????
#???
yield Request(url, callback=self.parse)
#15.5
#1
# Obey robots.txt rules
??????.py 文件源码
python
阅读 23
收藏 0
点赞 0
评论 0
评论列表
文章目录