我正在执行以下Twitter API请求:
https://api.twitter.com/1.1/search/tweets.json?q=%23WOMGif
我得到的结果之一是:
{:metadata=>{:iso_language_code=>"es", :result_type=>"recent"},
:created_at=>"Tue Oct 27 19:05:18 +0000 2015",
:id=>659083467276361728,
:id_str=>"659083467276361728",
:text=>
"cuando me dijieron que @womchile @WomChileCL va a tener 4g #WomGif https://t.co/x9nOwPosdP",
:source=>
"<a href=\"http://twitter.com\" rel=\"nofollow\">Twitter Web Client</a>",
:truncated=>false,
:in_reply_to_status_id=>nil,
:in_reply_to_status_id_str=>nil,
:in_reply_to_user_id=>nil,
:in_reply_to_user_id_str=>nil,
:in_reply_to_screen_name=>nil,
:user=>
{:id=>119559070,
:id_str=>"119559070",
:name=>"Israel muñoz arevalo",
:screen_name=>"blackisra",
:location=>"",
:description=>"diseñador 3d, infografo, musico, futbolero...",
:url=>"http://t.co/DI7Kq8jr6W",
:entities=>
{:url=>
{:urls=>
[{:url=>"http://t.co/DI7Kq8jr6W",
:expanded_url=>"http://israel.wide.cl",
:display_url=>"israel.wide.cl",
:indices=>[0, 22]}]},
:description=>{:urls=>[]}},
:protected=>false,
:followers_count=>128,
:friends_count=>181,
:listed_count=>0,
:created_at=>"Thu Mar 04 00:46:38 +0000 2010",
:favourites_count=>91,
:utc_offset=>-10800,
:time_zone=>"Atlantic Time (Canada)",
:geo_enabled=>true,
:verified=>false,
:statuses_count=>3598,
:lang=>"en",
:contributors_enabled=>false,
:is_translator=>false,
:is_translation_enabled=>false,
:profile_background_color=>"131516",
:profile_background_image_url=>
"http://abs.twimg.com/images/themes/theme14/bg.gif",
:profile_background_image_url_https=>
"https://abs.twimg.com/images/themes/theme14/bg.gif",
:profile_background_tile=>true,
:profile_image_url=>
"http://pbs.twimg.com/profile_images/486269167490699264/qyA3H5gF_normal.jpeg",
:profile_image_url_https=>
"https://pbs.twimg.com/profile_images/486269167490699264/qyA3H5gF_normal.jpeg",
:profile_banner_url=>
"https://pbs.twimg.com/profile_banners/119559070/1404771189",
:profile_link_color=>"00BBCC",
:profile_sidebar_border_color=>"000000",
:profile_sidebar_fill_color=>"000000",
:profile_text_color=>"FFFFFF",
:profile_use_background_image=>true,
:has_extended_profile=>false,
:default_profile=>false,
:default_profile_image=>false,
:following=>false,
:follow_request_sent=>false,
:notifications=>false},
:geo=>nil,
:coordinates=>nil,
:place=>nil,
:contributors=>nil,
:is_quote_status=>false,
:retweet_count=>0,
:favorite_count=>0,
:entities=>
{:hashtags=>[{:text=>"WomGif", :indices=>[59, 66]}],
:symbols=>[],
:user_mentions=>
[{:screen_name=>"womchile",
:name=>"WOM",
:id=>3251660537,
:id_str=>"3251660537",
:indices=>[23, 32]},
{:screen_name=>"WomChileCL",
:name=>"Wom Chile",
:id=>3367496379,
:id_str=>"3367496379",
:indices=>[33, 44]}],
:urls=>
[{:url=>"https://t.co/x9nOwPosdP",
:expanded_url=>
"http://twitter.com/blackisra/status/659083467276361728/photo/1",
:display_url=>"pic.twitter.com/x9nOwPosdP",
:indices=>[67, 90]}]},
:favorited=>false,
:retweeted=>false,
:possibly_sensitive=>false,
:lang=>"es"}
如果我专门针对此推文发出请求:
https://api.twitter.com/1.1/statuses/show.json?id=659083467276361728
我得到了以下结果:
{:created_at=>"Tue Oct 27 19:05:18 +0000 2015",
:id=>659083467276361728,
:id_str=>"659083467276361728",
:text=>
"cuando me dijieron que @womchile @WomChileCL va a tener 4g #WomGif https://t.co/x9nOwPosdP",
:source=>
"<a href=\"http://twitter.com\" rel=\"nofollow\">Twitter Web Client</a>",
:truncated=>false,
:in_reply_to_status_id=>nil,
:in_reply_to_status_id_str=>nil,
:in_reply_to_user_id=>nil,
:in_reply_to_user_id_str=>nil,
:in_reply_to_screen_name=>nil,
:user=>
{:id=>119559070,
:id_str=>"119559070",
:name=>"Israel muñoz arevalo",
:screen_name=>"blackisra",
:location=>"",
:description=>"diseñador 3d, infografo, musico, futbolero...",
:url=>"http://t.co/DI7Kq8jr6W",
:entities=>
{:url=>
{:urls=>
[{:url=>"http://t.co/DI7Kq8jr6W",
:expanded_url=>"http://israel.wide.cl",
:display_url=>"israel.wide.cl",
:indices=>[0, 22]}]},
:description=>{:urls=>[]}},
:protected=>false,
:followers_count=>128,
:friends_count=>181,
:listed_count=>0,
:created_at=>"Thu Mar 04 00:46:38 +0000 2010",
:favourites_count=>91,
:utc_offset=>-10800,
:time_zone=>"Atlantic Time (Canada)",
:geo_enabled=>true,
:verified=>false,
:statuses_count=>3598,
:lang=>"en",
:contributors_enabled=>false,
:is_translator=>false,
:is_translation_enabled=>false,
:profile_background_color=>"131516",
:profile_background_image_url=>
"http://abs.twimg.com/images/themes/theme14/bg.gif",
:profile_background_image_url_https=>
"https://abs.twimg.com/images/themes/theme14/bg.gif",
:profile_background_tile=>true,
:profile_image_url=>
"http://pbs.twimg.com/profile_images/486269167490699264/qyA3H5gF_normal.jpeg",
:profile_image_url_https=>
"https://pbs.twimg.com/profile_images/486269167490699264/qyA3H5gF_normal.jpeg",
:profile_banner_url=>
"https://pbs.twimg.com/profile_banners/119559070/1404771189",
:profile_link_color=>"00BBCC",
:profile_sidebar_border_color=>"000000",
:profile_sidebar_fill_color=>"000000",
:profile_text_color=>"FFFFFF",
:profile_use_background_image=>true,
:has_extended_profile=>false,
:default_profile=>false,
:default_profile_image=>false,
:following=>nil,
:follow_request_sent=>nil,
:notifications=>nil},
:geo=>nil,
:coordinates=>nil,
:place=>nil,
:contributors=>nil,
:is_quote_status=>false,
:retweet_count=>0,
:favorite_count=>0,
:entities=>
{:hashtags=>[{:text=>"WomGif", :indices=>[59, 66]}],
:symbols=>[],
:user_mentions=>
[{:screen_name=>"womchile",
:name=>"WOM",
:id=>3251660537,
:id_str=>"3251660537",
:indices=>[23, 32]},
{:screen_name=>"WomChileCL",
:name=>"Wom Chile",
:id=>3367496379,
:id_str=>"3367496379",
:indices=>[33, 44]}],
:urls=>[],
:media=>
[{:id=>659083465053360128,
:id_str=>"659083465053360128",
:indices=>[67, 90],
:media_url=>"http://pbs.twimg.com/tweet_video_thumb/CSWI62PW0AAoQnR.png",
:media_url_https=>
"https://pbs.twimg.com/tweet_video_thumb/CSWI62PW0AAoQnR.png",
:url=>"https://t.co/x9nOwPosdP",
:display_url=>"pic.twitter.com/x9nOwPosdP",
:expanded_url=>
"http://twitter.com/blackisra/status/659083467276361728/photo/1",
:type=>"photo",
:sizes=>
{:medium=>{:w=>244, :h=>200, :resize=>"fit"},
:thumb=>{:w=>150, :h=>150, :resize=>"crop"},
:small=>{:w=>244, :h=>200, :resize=>"fit"},
:large=>{:w=>244, :h=>200, :resize=>"fit"}}}]},
:extended_entities=>
{:media=>
[{:id=>659083465053360128,
:id_str=>"659083465053360128",
:indices=>[67, 90],
:media_url=>"http://pbs.twimg.com/tweet_video_thumb/CSWI62PW0AAoQnR.png",
:media_url_https=>
"https://pbs.twimg.com/tweet_video_thumb/CSWI62PW0AAoQnR.png",
:url=>"https://t.co/x9nOwPosdP",
:display_url=>"pic.twitter.com/x9nOwPosdP",
:expanded_url=>
"http://twitter.com/blackisra/status/659083467276361728/photo/1",
:type=>"animated_gif",
:sizes=>
{:medium=>{:w=>244, :h=>200, :resize=>"fit"},
:thumb=>{:w=>150, :h=>150, :resize=>"crop"},
:small=>{:w=>244, :h=>200, :resize=>"fit"},
:large=>{:w=>244, :h=>200, :resize=>"fit"}},
:video_info=>
{:aspect_ratio=>[61, 50],
:variants=>
[{:bitrate=>0,
:content_type=>"video/mp4",
:url=>"https://pbs.twimg.com/tweet_video/CSWI62PW0AAoQnR.mp4"}]}}]},
:favorited=>false,
:retweeted=>false,
:possibly_sensitive=>false,
:possibly_sensitive_appealable=>false,
:lang=>"es"}
第二个结果包括media_url,这是我想要的(gif的链接),但第一个没有。
我唯一的猜测是,因为媒体是一个GIF动画,所以它不会在搜索结果中返回。
有没有办法搜索twitter api并返回包含所有结果的媒体?