Created
September 3, 2013 06:03
-
-
Save ramtiga/6420155 to your computer and use it in GitHub Desktop.
This file contains 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
# coding: utf-8 | |
require "open-uri" | |
require "rss" | |
require "twitter" | |
RSS_URI = "http://weather.livedoor.com/forecast/rss/3.xml" | |
chklist = "水戸|宇都宮|前橋|さいたま|千葉|東京|横浜|甲府" | |
Twitter.configure do |cnf| | |
cnf.consumer_key = "" | |
cnf.consumer_secret = "" | |
cnf.oauth_token = "" | |
cnf.oauth_token_secret = "" | |
end | |
rss = RSS::Parser.parse(RSS_URI, false) | |
rss.items.each do |item| | |
if item.title =~ /今日の天気/ && !item.title.scan(/#{chklist}/).empty? | |
Twitter.update(item.title) | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment