Skip to content

Instantly share code, notes, and snippets.

@czarrar
Created October 3, 2013 04:41
Show Gist options
  • Save czarrar/6805097 to your computer and use it in GitHub Desktop.
Save czarrar/6805097 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# Four inputs needed
if ARGV.count != 4
abort "$0 username email password article-id"
end
username = ARGV[0]
email = ARGV[1]
password = ARGV[2]
id = ARGV[1]
###
# SEND TO KINDLE
###
# # For some reason this doesn't work, can't find the url
# @api.send_to_kindle("id" => bookmark_info[:article_id], "email" => email)
require 'mechanize'
require 'nokogiri'
readability_url = "http://www.readability.com/#{username}/"
agent = Mechanize.new
# login (just in case)
login_page = agent.get readability_url
unless login_page.form == nil
unless login_page.form.username == nil
login_page.form.username = username
login_page.form.password = password
login_page.form.submit
end
end
# send to kindle
agent.post "http://www.readability.com/api/kindle/v1/generator", "id" => id, "email" => email
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment