I would like using the twitter API get all the tweets from a twitter list (of users).
I would like to have a JSON response with the all the tweets in the list. Will parse the JSON to look for hashtags and create graphs.
I would like to use ruby/rails doing it.
I were not able to find in the twitter API a way to search list.
Any insight is appreciated.
Asked
Active
Viewed 730 times
0

mamesaye
- 2,033
- 2
- 32
- 49
-
1Here you can find all the gems https://rubygems.org/ Here is the documentation for the twitter gem http://www.rubydoc.info/gems/twitter And an example for all tweets https://github.com/sferik/twitter/blob/master/examples/AllTweets.md – SupineDread89 Oct 04 '17 at 15:52
-
the gems are user related not LIST. My list has over 400 people. – mamesaye Oct 04 '17 at 18:05
1 Answers
0
This is what I end up doing. In the model i added the function:
def self.list_latest()
list = URI.parse('https://twitter.com/USERNAME/LISTNAME')
$client.list_timeline(list).each do |tweet|
unless exists?(tweet_id: tweet.id)
create!(
tweet_id: tweet.id,
content: tweet.text,
screen_name: tweet.user.screen_name,
)
end
end
end
I get the tweets from my list and add them to my DB if the tweet ID does not exist.
Hope it helps.

mamesaye
- 2,033
- 2
- 32
- 49