Skip to content

Instantly share code, notes, and snippets.

@kmdsbng
Created December 28, 2013 11:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kmdsbng/8158609 to your computer and use it in GitHub Desktop.
Save kmdsbng/8158609 to your computer and use it in GitHub Desktop.
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