Skip to content

Instantly share code, notes, and snippets.

@tvandervossen
Created July 10, 2010 19:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tvandervossen/470958 to your computer and use it in GitHub Desktop.
Save tvandervossen/470958 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'open-uri'
require 'rubygems'
require 'active_support'
account = 'thijs'
max_id = 18216684927
File.open("#{account}.txt", 'w') do |f|
loop do
puts max_id
uri = URI.parse("http://twitter.com/statuses/user_timeline/#{account}.xml?max_id=#{max_id}&count=100")
data = Hash.from_xml(uri.read)
data['statuses'].each do |status|
f.puts "#{status['id']}: #{status['text']} (#{status['created_at']})"
end
if data['statuses'].length == 0
break
end
max_id = data['statuses'].last['id']
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment