[英]ruby/rails ruby/rails How can I get all the tweets from Twitter LIST (of users) using the Twitter API?
我想使用twitter API从(用户)twitter列表中获取所有tweet。
我想使用列表中的所有tweet进行JSON响应。 将解析JSON以查找主题标签并创建图。 我想用ruby / rails做到这一点。 我无法在twitter API中找到搜索列表的方法。 任何见解均表示赞赏。
这就是我最终要做的。 在模型中,我添加了功能:
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
我从列表中获取了tweet,如果tweet ID不存在,则将它们添加到我的数据库中。
希望能帮助到你。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.