【问题标题】:Twitter API not returning imagesTwitter API 不返回图片
【发布时间】:2017-02-04 04:35:14
【问题描述】:

如果我只是对以下推文进行简单的 twitter API 请求,它应该附有多个图像,但它在媒体实体对象中没有返回任何内容

https://twitter.com/taloncopters/status/780281505826299904

这是我正在做的请求:https://api.twitter.com/1.1/statuses/show/780281505826299904.json

这是我的实体对象:

{
  :hashtags=>[{:text=>"rescue", :indices=>[17, 24]}, {:text=>"SAR", :indices=>[110, 114]}], 
  :symbols=>[], 
  :user_mentions=>[
    {:screen_name=>"Ravensoars", :name=>"Jim", :id=>2568464354, :id_str=>"2568464354", :indices=>[38, 49]}, 
    {:screen_name=>"CoquitlamSAR", :name=>"Coquitlam SAR", :id=>203212566, :id_str=>"203212566", :indices=>[54, 67]}
  ], 
  :urls=>[{:url=>"SHORTENED_URL", :expanded_url=>"https://twitter.com/i/web/status/780281505826299904", :display_url=>"twitter.com/i/web/status/7…", :indices=>[116, 139]}]
}

没有图像,甚至没有媒体密钥,尽管当您直接查看推文时有多个。

有什么方法可以得到这些图像?

【问题讨论】:

    标签: javascript ruby-on-rails ruby-on-rails-4 twitter


    【解决方案1】:

    看起来 twitter 上周更新了他们的 API。需要在我的通话中添加tweet_mode: 'extended'

    【讨论】:

    【解决方案2】:

    对于那些使用oAuth Twitter Feed for Developers 的用户,您只需将['tweet_mode' => 'extended'] 添加为 getTweets() 函数的第三个参数即可。

    例子:

    <?php $tweets = getTweets($number_of_tweets, $twitter_screenname_to_load, ['tweet_mode' => 'extended']); ?>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-11-05
      • 1970-01-01
      • 1970-01-01
      • 2015-11-05
      • 2017-04-04
      • 2018-11-15
      • 2018-11-14
      • 1970-01-01
      相关资源
      最近更新 更多