public
Last active

Import your ReadItLater bookmarks into Instapaper

  • Download Gist
ril_to_instapaper.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
#!/usr/bin/env ruby
 
# 1. export your RIL bookmarks
# 2. save this file to the same directory where your ril_export.html is
# 3. change username and password in the script bellow
# 4. run 'ruby ril_to_instapaper.rb' in terminal
 
require "cgi"
require "net/http"
require "net/https"
 
ril = File.read("ril_export.html")
 
unread = ril.scan(%r{<ul>.*?</ul>}m).first
 
http = Net::HTTP.new("www.instapaper.com", 443)
http.use_ssl = true
 
unread.scan(%r{href="(.*?)".*?>(.*?)<}).each do |url, title|
puts "#{url}: #{title}"
http.post("/api/add", {
:username => "john.doe@example.com",
:password => "top secret",
:url => url,
:title => title,
}.map { |k, v| "#{k}=#{CGI.escape(v)}" }.join("&"))
end

Just what I needed. It worked great.

Thanks for sharing.

well done, worked great for me.

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.