Skip to content

Instantly share code, notes, and snippets.

@maddox
Created March 10, 2009 17:46
Show Gist options
  • Save maddox/77027 to your computer and use it in GitHub Desktop.
Save maddox/77027 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'net/http'
# usage
# tweet2tumblr http://twitter.com/kristaderamus/statuses/1278922567
# authentication
email = "your@email.com"
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