No media_url in reslt of statuses/user_timeline for some statuses


#1

We have problem when trying to get data from REST API for statuses/user_timeline method.
When we publish a post with more than 113 characters, we don not get the media tag or media_url value in result.

This is the result we get from Twitter API for status ID 779251385586122752 (image exists on the real status but media tag is not listed in API result):

stdClass Object
    (
        [created_at] => Fri Sep 23 09:29:42 +0000 2016
        [id] => 779251385586122752
        [id_str] => 779251385586122752
        [text] => La ciudad de #barcelona @bcn_ajuntament es la 8º mejor ciudad del mundo de 2016 según @TravelLeisure… https://t.co/cnyqssnrIL
        [truncated] => 1
        [entities] => stdClass Object
            (
                [hashtags] => Array
                    (
                        [0] => stdClass Object
                            (
                                [text] => barcelona
                                [indices] => Array
                                    (
                                        [0] => 13
                                        [1] => 23
                                    )

                            )

                    )

                [symbols] => Array
                    (
                    )

                [user_mentions] => Array
                    (
                    )

                [urls] => Array
                    (
                        [0] => stdClass Object
                            (
                                [url] => https://t.co/cnyqssnrIL
                                [expanded_url] => https://twitter.com/i/web/status/779251385586122752
                                [display_url] => twitter.com/i/web/status/7…
                                [indices] => Array
                                    (
                                        [0] => 102
                                        [1] => 125
                                    )

                            )

                    )

            )

        [source] => <a href="http://twitter.com" rel="nofollow">Twitter Web Client</a>
        [in_reply_to_status_id] => 
        [in_reply_to_status_id_str] => 
        [in_reply_to_user_id] => 
        [in_reply_to_user_id_str] => 
        [in_reply_to_screen_name] => 
        [user] => stdClass Object
            (
                [id] => 267682865
                [id_str] => 267682865
                [name] => nicebarcelona.es
                [screen_name] => nice_barcelona
                [location] => Barcelona
                [description] => #nicebarcelona.es #magazine con #entrevistas #coolnews #lifestyle #viajes #nbrecomendate - email : redaccion@nicebarcelona.es - SĂŤGUENOS !!
                [url] => https://t.co/oh8lUsPFE2
                [entities] => stdClass Object
                    (
                        [url] => stdClass Object
                            (
                                [urls] => Array
                                    (
                                        [0] => stdClass Object
                                            (
                                                [url] => https://t.co/oh8lUsPFE2
                                                [expanded_url] => http://www.nicebarcelona.es
                                                [display_url] => nicebarcelona.es
                                                [indices] => Array
                                                    (
                                                        [0] => 0
                                                        [1] => 23
                                                    )

                                            )

                                    )

                            )

                        [description] => stdClass Object
                            (
                                [urls] => Array
                                    (
                                    )

                            )

                    )

                [protected] => 
                [followers_count] => 1878
                [friends_count] => 2087
                [listed_count] => 40
                [created_at] => Thu Mar 17 10:47:27 +0000 2011
                [favourites_count] => 1347
                [utc_offset] => 7200
                [time_zone] => Madrid
                [geo_enabled] => 
                [verified] => 
                [statuses_count] => 569
                [lang] => es
                [contributors_enabled] => 
                [is_translator] => 
                [is_translation_enabled] => 
                [profile_background_color] => F7F9FA
                [profile_background_image_url] => http://pbs.twimg.com/profile_background_images/433588573900505088/M_FUpP3Q.jpeg
                [profile_background_image_url_https] => https://pbs.twimg.com/profile_background_images/433588573900505088/M_FUpP3Q.jpeg
                [profile_background_tile] => 
                [profile_image_url] => http://pbs.twimg.com/profile_images/752099477595488256/ypO7gGtT_normal.jpg
                [profile_image_url_https] => https://pbs.twimg.com/profile_images/752099477595488256/ypO7gGtT_normal.jpg
                [profile_banner_url] => https://pbs.twimg.com/profile_banners/267682865/1468170626
                [profile_link_color] => 9266CC
                [profile_sidebar_border_color] => FFFFFF
                [profile_sidebar_fill_color] => F2F8FA
                [profile_text_color] => 333333
                [profile_use_background_image] => 1
                [has_extended_profile] => 
                [default_profile] => 
                [default_profile_image] => 
                [following] => 
                [follow_request_sent] => 
                [notifications] => 
            )

        [geo] => 
        [coordinates] => 
        [place] => 
        [contributors] => 
        [is_quote_status] => 
        [retweet_count] => 3
        [favorite_count] => 6
        [favorited] => 
        [retweeted] => 
        [possibly_sensitive] => 
        [lang] => es
    )

And, this is the result we get from Twitter API for status ID 778944116449275905 (image exists and media tag is listed in API result):

stdClass Object
    (
        [created_at] => Thu Sep 22 13:08:44 +0000 2016
        [id] => 778944116449275905
        [id_str] => 778944116449275905
        [text] => El 30 de septiembre @Cadena_Dial #LoMejorDeAquiYDeAlli @fargahospitalet @TicketmasterES @ticketea @elcorteingles https://t.co/kgZzvSVFyM
        [truncated] => 
        [entities] => stdClass Object
            (
                [hashtags] => Array
                    (
                        [0] => stdClass Object
                            (
                                [text] => LoMejorDeAquiYDeAlli
                                [indices] => Array
                                    (
                                        [0] => 33
                                        [1] => 54
                                    )

                            )

                    )

                [symbols] => Array
                    (
                    )

                [user_mentions] => Array
                    (
                    )

                [urls] => Array
                    (
                    )

                [media] => Array
                    (
                        [0] => stdClass Object
                            (
                                [id] => 778944075647053824
                                [id_str] => 778944075647053824
                                [indices] => Array
                                    (
                                        [0] => 113
                                        [1] => 136
                                    )

                                [media_url] => http://pbs.twimg.com/media/Cs9dgoDWcAA0R5h.jpg
                                [media_url_https] => https://pbs.twimg.com/media/Cs9dgoDWcAA0R5h.jpg
                                [url] => https://t.co/kgZzvSVFyM
                                [display_url] => pic.twitter.com/kgZzvSVFyM
                                [expanded_url] => https://twitter.com/nice_barcelona/status/778944116449275905/photo/1
                                [type] => photo
                                [sizes] => stdClass Object
                                    (
                                        [thumb] => stdClass Object
                                            (
                                                [w] => 150
                                                [h] => 150
                                                [resize] => crop
                                            )

                                        [large] => stdClass Object
                                            (
                                                [w] => 1310
                                                [h] => 1600
                                                [resize] => fit
                                            )

                                        [medium] => stdClass Object
                                            (
                                                [w] => 983
                                                [h] => 1200
                                                [resize] => fit
                                            )

                                        [small] => stdClass Object
                                            (
                                                [w] => 557
                                                [h] => 680
                                                [resize] => fit
                                            )

                                    )

                            )

                    )

            )

        [extended_entities] => stdClass Object
            (
                [media] => Array
                    (
                        [0] => stdClass Object
                            (
                                [id] => 778944075647053824
                                [id_str] => 778944075647053824
                                [indices] => Array
                                    (
                                        [0] => 113
                                        [1] => 136
                                    )

                                [media_url] => http://pbs.twimg.com/media/Cs9dgoDWcAA0R5h.jpg
                                [media_url_https] => https://pbs.twimg.com/media/Cs9dgoDWcAA0R5h.jpg
                                [url] => https://t.co/kgZzvSVFyM
                                [display_url] => pic.twitter.com/kgZzvSVFyM
                                [expanded_url] => https://twitter.com/nice_barcelona/status/778944116449275905/photo/1
                                [type] => photo
                                [sizes] => stdClass Object
                                    (
                                        [thumb] => stdClass Object
                                            (
                                                [w] => 150
                                                [h] => 150
                                                [resize] => crop
                                            )

                                        [large] => stdClass Object
                                            (
                                                [w] => 1310
                                                [h] => 1600
                                                [resize] => fit
                                            )

                                        [medium] => stdClass Object
                                            (
                                                [w] => 983
                                                [h] => 1200
                                                [resize] => fit
                                            )

                                        [small] => stdClass Object
                                            (
                                                [w] => 557
                                                [h] => 680
                                                [resize] => fit
                                            )

                                    )

                            )

                    )

            )

        [source] => <a href="http://twitter.com/download/android" rel="nofollow">Twitter for Android</a>
        [in_reply_to_status_id] => 
        [in_reply_to_status_id_str] => 
        [in_reply_to_user_id] => 
        [in_reply_to_user_id_str] => 
        [in_reply_to_screen_name] => 
        [user] => stdClass Object
            (
                [id] => 267682865
                [id_str] => 267682865
                [name] => nicebarcelona.es
                [screen_name] => nice_barcelona
                [location] => Barcelona
                [description] => #nicebarcelona.es #magazine con #entrevistas #coolnews #lifestyle #viajes #nbrecomendate - email : redaccion@nicebarcelona.es - SĂŤGUENOS !!
                [url] => https://t.co/oh8lUsPFE2
                [entities] => stdClass Object
                    (
                        [url] => stdClass Object
                            (
                                [urls] => Array
                                    (
                                        [0] => stdClass Object
                                            (
                                                [url] => https://t.co/oh8lUsPFE2
                                                [expanded_url] => http://www.nicebarcelona.es
                                                [display_url] => nicebarcelona.es
                                                [indices] => Array
                                                    (
                                                        [0] => 0
                                                        [1] => 23
                                                    )

                                            )

                                    )

                            )

                        [description] => stdClass Object
                            (
                                [urls] => Array
                                    (
                                    )

                            )

                    )

                [protected] => 
                [followers_count] => 1878
                [friends_count] => 2087
                [listed_count] => 40
                [created_at] => Thu Mar 17 10:47:27 +0000 2011
                [favourites_count] => 1347
                [utc_offset] => 7200
                [time_zone] => Madrid
                [geo_enabled] => 
                [verified] => 
                [statuses_count] => 569
                [lang] => es
                [contributors_enabled] => 
                [is_translator] => 
                [is_translation_enabled] => 
                [profile_background_color] => F7F9FA
                [profile_background_image_url] => http://pbs.twimg.com/profile_background_images/433588573900505088/M_FUpP3Q.jpeg
                [profile_background_image_url_https] => https://pbs.twimg.com/profile_background_images/433588573900505088/M_FUpP3Q.jpeg
                [profile_background_tile] => 
                [profile_image_url] => http://pbs.twimg.com/profile_images/752099477595488256/ypO7gGtT_normal.jpg
                [profile_image_url_https] => https://pbs.twimg.com/profile_images/752099477595488256/ypO7gGtT_normal.jpg
                [profile_banner_url] => https://pbs.twimg.com/profile_banners/267682865/1468170626
                [profile_link_color] => 9266CC
                [profile_sidebar_border_color] => FFFFFF
                [profile_sidebar_fill_color] => F2F8FA
                [profile_text_color] => 333333
                [profile_use_background_image] => 1
                [has_extended_profile] => 
                [default_profile] => 
                [default_profile_image] => 
                [following] => 
                [follow_request_sent] => 
                [notifications] => 
            )

        [geo] => 
        [coordinates] => 
        [place] => 
        [contributors] => 
        [is_quote_status] => 
        [retweet_count] => 0
        [favorite_count] => 1
        [favorited] => 
        [retweeted] => 
        [possibly_sensitive] => 
        [lang] => es
    )

#2

Are you adding tweet_mode=extended on your API call to get the new extended Tweet format?


#3

I tried the solution and got the answer. It seems to be a latest change in Twitter API? https://dev.twitter.com/overview/api/upcoming-changes-to-tweets
We were on tweet_mode=compat by default but, I think the result output is different on extended mode.

Thank you Andy.


#4

That’s correct, this was implemented last week per our announcement.