Created
December 28, 2013 11:46
-
-
Save kmdsbng/8158609 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 'feedly' | |
require 'pp' | |
ACCESS_TOKEN = "AQAAAxBc..." | |
def main | |
feed_urls = STDIN.readlines.map(&:chomp) | |
feed_ids = feed_urls.map {|url| 'feed/' + url} | |
feedly = Feedly.new(:access_token => ACCESS_TOKEN) | |
subscriptions = feedly.get_subscriptions | |
subscribed_feed_ids = subscriptions.map {|h| h['id']} | |
new_feed_ids = feed_ids - subscribed_feed_ids | |
unless new_feed_ids.empty? | |
puts "[register new feeds]" | |
pp new_feed_ids | |
new_feed_ids.each {|feed_id| | |
feedly.post_subscriptions(feed_id) | |
} | |
end | |
end | |
main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment