try:# //*[@id="J-items-content"]/div[5]/div/div[1]/div[2]/div[1]/div[1]# years = item.xpath('//*[@id="J-items-content"]/div[4]/div/div[1]/div[2]/div[1]/div[1]/text()') # 只能定义单一年份
years = item.xpath('.//div[@class="s-gold-supplier-year-icon"]/text()')# 爬取年份(店铺经营的年份)
products = item.xpath('.//div[@class="product"]')for product in products:
img = product.xpath('.//div/a/img/@src')print('https:'+ img)# print('years: ' + str(years[0]))except:print('oh my god, it is too hard!')