Transfer Read Later JSON export from Reeder to Readwise Reader via its API. Batches posts because of API's 20 requests per minute rate limit.
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
# Transfer Read Later JSON export from Reeder to Readwise Reader via its API. | |
# Batches posts because of API's 20 requests per minute rate limit. | |
require 'json' | |
require 'httparty' | |
offset = 0 | |
max = 20 | |
token = ENV['token'] | |
api_url = 'https://readwise.io/api/v3/save/' | |
f = File.read('ReadLater.json') | |
links = JSON.parse(f) | |
for i in offset...links.size do | |
res = HTTParty.post(api_url, { | |
body: { "url" => links[i]['link'] }.to_json, | |
headers: { | |
"Content-Type" => "application/json", | |
"Authorization" => "Token #{token}" | |
} | |
}) | |
puts "#{i} - #{res.body}" | |
sleep(61) if (i + 1) % max == 0 | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment