699pic

爬虫————获取图片(scrapy使用自带类 ImagesPipeline)

我们两清 提交于 2019-12-06 08:41:10
爬取的图片网址为: http://699pic.com/collectInfo/273785 解决问题的参考链接: https://blog.csdn.net/loner_fang/article/details/81111879 问题代码1 imgpro.py 1 # -*- coding: utf-8 -*- 2 import scrapy 3 4 from tupian.items import TupianItem 5 from scrapy.selector.unified import SelectorList 6 7 8 class ImgproSpider(scrapy.Spider): 9 name = 'imgpro' 10 #allowed_domains = ['699pic.com'] 11 start_urls = ['http://699pic.com/collectInfo/273785'] 12 13 def parse(self, response): 14 li_ul = response.xpath('/html/body/div[11]/div/ul') 15 # print(type(li_ul)) 16 for li in li_ul : 17 img_src = li.xpath('./li/a/img/@src').extract(