Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Import your ReadItLater bookmarks into Instapaper
#!/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
@gbussmann

This comment has been minimized.

Show comment Hide comment
@gbussmann

gbussmann Aug 8, 2012

Just what I needed. It worked great.

Thanks for sharing.

Just what I needed. It worked great.

Thanks for sharing.

@ghost

This comment has been minimized.

Show comment Hide comment
@ghost

ghost Sep 2, 2012

Awesome. Thanks.

ghost commented Sep 2, 2012

Awesome. Thanks.

@benjiwheeler

This comment has been minimized.

Show comment Hide comment
@benjiwheeler

benjiwheeler Dec 11, 2013

well done, worked great for me.

well done, worked great for me.

@amadeusp

This comment has been minimized.

Show comment Hide comment
@amadeusp

amadeusp Jun 22, 2014

Thank you very much!

Thank you very much!

@sferguson-utest

This comment has been minimized.

Show comment Hide comment
@sferguson-utest

sferguson-utest Aug 20, 2014

awesome. thank you!

awesome. thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment