Skip to content

Instantly share code, notes, and snippets.

@turboladen
Created February 18, 2011 19:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save turboladen/834201 to your computer and use it in GitHub Desktop.
Save turboladen/834201 to your computer and use it in GitHub Desktop.
Gets all tweets from a user into an single string of HTML
# Be sure to `gem install twitter` first, of course...
require 'rubygems'
require 'twitter'
tweets = ""
pages = 10 # The Twitter API paginates responses...
# Get all the tweets to a single String, where each is surrounded in HTML
(1..pages).each do |page|
Twitter.user_timeline("Fahrni", :page => page).each do |tweet|
tweets << "<p>#{tweet.text}</p>"
end
end
# Output to screen
puts tweets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment