关于XPath和CSSpath路径选取可以用打开浏览器F12选中元素点击鼠标右键选取。
weather/items.py
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# https://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class WeatherItem(scrapy.Item):
# define the fields for your item here like:
# name = scrapy.Field()
date = scrapy.Field()
week = scrapy.Field()
weather = scrapy.Field()
maxTemperature = scrapy.Field()
minTemperature = scrapy.Field()
weather/pipelines.py
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html
import time, os.path
class WeatherPipeline(object):
def