welcome to myblog Dome地址 爬取某个车站的图片 item.py 中 1.申明item 的fields class PhotoItem(scrapy.Item): # define the fields for your item here like: # name = scrapy.Field() image_urls = scrapy.Field() images = scrapy.Field() pass spider 的image.py 导入头文件 from Phot
纪念我们闹过的矛盾,只想平淡如水 import requestsimport reurl = 'http://www.xiaohuar.com/list-1-%s.html'for i in range(4): temp = url % i response =requests.get(temp) html = response.text #img_urls=re.findall(r"/d/file/\d+/\w+\.jpg",html)#取出图片URL #img_urls1 = re
话不多说,直接开始,直接放上整个程序过程 1.创建工程和生成spiders就不用说了,会用scrapy的都知道. 2.items.py class HarryItem(scrapy.Item): # define the fields for your item here like: img_url = scrapy.Field() img_name = scrapy.Field() 3.pipelines.py import os from harry.settings import IMAG