Created
March 10, 2009 17:46
-
-
Save maddox/77027 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
#!/usr/bin/env ruby | |
require 'net/http' | |
# usage | |
# tweet2tumblr http://twitter.com/kristaderamus/statuses/1278922567 | |
# authentication | |
email = "[email protected]" | |
password= "yourpassword" | |
def twicture(tweet_url) | |
tweet_url.match(/(\d\d\d+)/) | |
%{<div> | |
<p><img src="http://twictur.es/i/#{$1}.gif" /></p> | |
<p>image provided by <a href="http://twictur.es">twictur.es</a> | original tweet <a href="#{tweet_url}">here</a></p> | |
</div>} | |
end | |
if (!ARGV[0]) | |
puts "enter a tweet url" | |
else | |
res = Net::HTTP.post_form(URI.parse('http://www.tumblr.com/api/write'), | |
{:email => email, :password => password, | |
:type => 'regular', :title => '', :body => twicture(ARGV[0])}) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment