Created
February 28, 2012 13:45
-
-
Save yosmoc/1932623 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
require 'net/http' | |
require 'uri' | |
class KindleIt | |
def initialize(email) | |
@email = email | |
@account, @domain = @email.split('@') | |
end | |
def post(url) | |
uri = URI.parse "http://fivefilters.org/kindle-it/send.php?context=send&url=#{url}&email=#{@account}&domain=#{domain_number(@domain)}" | |
puts "post #{url} to KindleIt" | |
Net::HTTP.get(uri) | |
end | |
private | |
def domain_number(domain) | |
if domain == 'free.kindle.com' then | |
return 1; | |
elsif domain == 'kindle.com' then | |
return 2; | |
else | |
return 0; | |
end | |
end | |
end | |
if __FILE__ == $0 | |
# require 'pit' | |
# | |
# config = Pit::get("kindle-it", :require => { | |
# "email" => "your kindle email address" | |
# }); | |
# kindleit = KindleIt.new(config.email) | |
kindleit = KindleIt.new('[email protected]') | |
BASE_URL = 'http://www.mao55.net/gohan/main.php?page=' | |
(120..123).to_a.reverse.each do |item| | |
kindleit.post(BASE_URL + item.to_s) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment