Last active
August 29, 2015 14:03
-
-
Save tknzk/413e1c104c7f6a98c792 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
require 'rubygems' | |
require 'feed-normalizer' | |
require 'open-uri' | |
require 'twitter' | |
client = Twitter::REST::Client.new do |config| | |
config.consumer_key = ENV['TWITTER_CONSUMER_KEY'] | |
config.consumer_secret = ENV['TWITTER_CONSUMER_SECRET'] | |
config.access_token = ENV['TWITTER_ACCESS_TOKEN'] | |
config.access_token_secret = ENV['TWITTER_ACCESS_TOKEN_SECRET'] | |
end | |
uri_jazz_song_rank = 'https://itunes.apple.com/jp/rss/topsongs/limit=100/genre=11/xml' | |
feed = FeedNormalizer::FeedNormalizer.parse open(uri_jazz_song_rank) | |
text = "" | |
itunes_url = "https://itunes.apple.com/jp/album/rakurai/id887425587?i=887425634" | |
i = 1 | |
feed.entries.each { |e| | |
if e.title == "rakurai - YAPANI!" | |
text = "現在 iTunes Jazz チャート #{i}位 " + e.title + " #{itunes_url}" + " updated_at:" + e.last_updated.strftime("%Y-%m-%d %H:%M:%S %Z") | |
client.update(text) | |
break | |
end | |
i+=1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment