汽车之间案例:
import scrapy class CarSpider(scrapy.Spider): name = 'car' allowed_domains = ['https://car.autohome.com.cn/price/brand-15.html'] # 注意如果你的请求的接口是html为结尾的 那么是不需要加/的 start_urls = ['https://car.autohome.com.cn/price/brand-15.html'] def parse(self, response): name_list = response.xpath('//div[@class="main-title"]/a/text()') price_list = response.xpath('//div[@class="main-lever"]//span/span/text()') for i in range(len(name_list)): name = name_list[i].extract() price = price_list[i].extract() print(name,price)
scrapy架构组成:
工作原理:
标签:架构,name,price,list,scrapy,html,scarpy,原理,class From: https://www.cnblogs.com/zhaolei0419/p/17024163.html