Created
December 14, 2016 11:10
-
-
Save mmitou/706319dbae72e8ce016884d840d5573a to your computer and use it in GitHub Desktop.
RSS取得
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
description | link | version | |
---|---|---|---|
Yahoo! JAPANの天気・災害に掲載されている最新の情報を提供しています。 | http://rdsig.yahoo.co.jp/weather/rss/RV=1/RU=aHR0cDovL3dlYXRoZXIueWFob28uY28uanAvd2VhdGhlci9qcC8xNC8- | 2.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scrapy | |
class WeatherSpider(scrapy.Spider): | |
name = "weather" | |
start_urls = [ | |
'https://rss-weather.yahoo.co.jp/rss/days/4610.xml' | |
] | |
def parse(self, response): | |
yield { | |
'version' : response.xpath('//rss/@version').extract_first(), | |
'description' : response.xpath('//rss/channel/description/text()').extract_first(), | |
'link' : response.xpath('//rss/channel/link/text()').extract_first() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment