Created
October 3, 2013 04:41
-
-
Save czarrar/6805097 to your computer and use it in GitHub Desktop.
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
#!/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