Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env ruby
- require 'rubygems'
- require 'twitter'
- require 'pp'
- phrase = 'veader'
- search = Twitter::Search.new phrase, :since => (Date.today - 2),
- :until => (Date.today - 1)
- results = []
- # twitter limits search to 100 message per page and 1500 messages total
- 1.upto(15) do |page|
- # NOTE: the per_page(100) may be redundant and repetitive
- chunk = search.page(page).per_page(100).fetch(true).results
- break if chunk.empty?
- chunk.each do |tweet|
- results << { :property_id => 0,
- :create_date => Time.now,
- :post_date => tweet['created_at'],
- :post_content => tweet['text'] }
- end
- end
- pp results
Add Comment
Please, Sign In to add comment