[英]Getting all retweets with twitter gem
我想使用twitter gem獲取原始推文的轉發。 如果我將原始身份ID賦予twitter api,我想獲取所有轉發。 有沒有辦法用twitter gem做到這一點。 我沒有找到任何解決方案
您可以使用twitter gem。
將其添加到您的Gemfile中並運行bundle install
。
現在,您需要初始化twitter rest客戶端。
client = Twitter::REST::Client.new do |config|
config.consumer_key = "YOUR_CONSUMER_KEY"
config.consumer_secret = "YOUR_CONSUMER_SECRET"
config.access_token = "YOUR_ACCESS_TOKEN"
config.access_token_secret = "YOUR_ACCESS_SECRET"
end
# @param tweet [Integer, String, URI, Twitter::Tweet] A Tweet ID, URI, or object.
# @param options [Hash] A customizable set of options.
# @option options [Integer] :count Specifies the number of records to retrieve.
# Must be less than or equal to 100.
# @option options [Boolean, String, Integer] :trim_user Each tweet returned in a
# timeline will include a user object with only the author's numerical ID when set
# to true, 't' or 1.
retweets = client.retweets(original_tweet_id, options = {})
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.