Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require "twitter"
- client = Twitter::REST::Client.new do |config|
- config.consumer_key = 'vvDpEO4YjkWQxFANOC860iDdZ'
- config.consumer_secret = 'iJBruzon2FeM7IllT38y1r2yjm0sLbXXjoAOlD8W9HgDxYoQe5'
- config.access_token = '1519115875-MDKhYr6SQ5BKi4ZcyFnIqZPn7AL0a7OfC2q8rsw'
- config.access_token_secret = 'Rvu3pyrwvuhnTu25642th0HVZGubzNhHTzRDCljKzwNMs'
- end
- #set max_id to max value
- mnid = 999999999999999999
- #set number of tweets you want to get
- max_no_tweets = 3500
- count = 0
- while(count < max_no_tweets)
- #each loop gets 200 tweet
- client.user_timeline('elonmusk', :count => 200, :max_id => mnid).each do |tweet|
- puts(tweet.text) if tweet.is_a?(Twitter::Tweet)
- #to get the next 200 tweet
- mnid = [mnid,tweet.id].min
- count+=1
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement