簡體   English   中英

ruby / rails ruby​​ / rails如何使用Twitter API從(用戶的)Twitter LIST獲取所有推文?

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM