Skip to content

Instantly share code, notes, and snippets.

@ramtiga
Created September 3, 2013 06:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ramtiga/6420155 to your computer and use it in GitHub Desktop.
Save ramtiga/6420155 to your computer and use it in GitHub Desktop.
# 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