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.
我想使用twitter API从Twitter列表(用户)获取所有推文。我想对列表中的所有推文进行JSON响应。将解析JSON以查找主题标签并创建图形。我想用ruby / rails来做。我无法在twitter API中找到搜索列表的方法。任何见解都表示赞赏。
1 个解决方案
#1
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.
如果推文ID不存在,我会从列表中获取推文并将其添加到我的数据库中。希望能帮助到你。
#1
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.
如果推文ID不存在,我会从列表中获取推文并将其添加到我的数据库中。希望能帮助到你。