1

当我有时从 API 发布推文时,推文 ID 会在执行后更改。我正在使用 Ruby 的Twitter Gem

@client = Twitter::REST::Client.new do |config|
  config.consumer_key        = ENV['TWITTER_CONSUMER_KEY']
  config.consumer_secret     = ENV['TWITTER_CONSUMER_KEY_SECRET']
  config.access_token        = token
  config.access_token_secret = token_secret
end

post_result = @client.update_with_media(content, image_file)
post_permalink = post_result.id
post_result = post_result.to_json

我得到以下回复

{"created_at":"Wed Feb 08 11:13:49 +0000 2017","id":829287112583286784,"id_str":"829287112583286784","text":"You must agree that the Classic Coffee without Chicory tastes thousands times better #ClassicCoffeeBrews <link>"}

当我尝试访问推文时,出现错误。

https://twitter.com/PebbleInWaters/status/8292871125832867842

手动浏览用户时间线,我发现推文 ID 已更改为829287114386894848

https://twitter.com/PebbleInWaters/status/829287114386894848

知道如何纠正这些吗?

4

0 回答 0