Missing media property in entities


#1

I found that in some tweets there is missing media entities, when tweet has video or gif. For example:

https://api.twitter.com/1.1/statuses/show/735246876396511232.json
{ "created_at": "Tue May 24 23:11:30 +0000 2016", "id": 735246876396511200, "id_str": "735246876396511232", "text": "A diferença entre assassinos e inocentes é que uns usam máscaras. 31 de Maio, 2a temporada #ScreamNaNetflix\nhttps://t.co/jjXypBQgGf", "truncated": false, "entities": { "hashtags": [], "symbols": [], "user_mentions": [], "urls": [ { "url": "https://t.co/jjXypBQgGf", "expanded_url": "https://amp.twimg.com/v/8e114b44-fc8d-4cce-aecf-658ee5e5477b", "display_url": "amp.twimg.com/v/8e114b44-fc8…", "indices": [....] } ] }, "source": "<a href="http://twitter.com" rel="nofollow">Twitter Web Client</a>", "in_reply_to_status_id": null, "in_reply_to_status_id_str": null, "in_reply_to_user_id": null, "in_reply_to_user_id_str": null, "in_reply_to_screen_name": null, "user": {...}, "geo": null, "coordinates": null, "place": null, "contributors": null, "is_quote_status": false, "retweet_count": 804, "favorite_count": 1102, "favorited": false, "retweeted": false, "possibly_sensitive": false, "possibly_sensitive_appealable": false, "lang": "pt" }
I read comments about same problem but they were one year old and closed with statment they are fixed.
So is it still a bug or am I doing someting wrong?


#2

Any news of this? I have seen the same issue with 2 more tweets.


#3

Which Tweet IDs are you talking about?

In the case of the example above, the media is from the Twitter Amplify media platform, so there’s no extended entity for that.


#4

I can’t seem to get the embedded URL in a status, for example, in id=780804331608109057

https://twitter.com/i/web/status/780804331608109057

When I retrieve this via GET /statuses/:id, with include_entities set to true, the response looks like this:

"text":"Here\u2019s WSJ \"An Underwhelming Trump-Clinton Debate\u201d trying to spin this as something other than a Clinton triumph\u2026 https:\/\/t.co\/dpkmphGI8k",
"truncated":true,
"entities":
  {"hashtags":[],"symbols":[],"user_mentions":[],"urls":        
   [{"url":"https:\/\/t.co\/dpkmphGI8k",
  "expanded_url":"https:\/\/twitter.com\/i\/web\/status\/780804331608109057",
   "display_url":"twitter.com\/i\/web\/status\/7\u2026","indices":[114,137]}]},
"source":"\u003ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\"rel=\"nofollow\"\u003eTweetDeck\u003c\/a\u003e",....

When viewed on my web client, the status instead displays the link to WSJ (referred through t.co)

What am I doing wrong here?


#5

You need to use tweet_mode=extended for the new longer Tweet format.


#6

Most appreciated!


#7

Also, for those who get here later, I think the most significant change in this new mode appears to be that the key text is no longer used in extended mode in the JSON response - that’s where the status text is, and unless you set tweet_mode=compatibility mode, you have to now use the key full_text


#8

Hi Andy,
I get a 401:Unauthorized error when I add the tweet_mode parameter… I’m using the statuses/user_timeline endpoint… exact same code minus the tweet_mode works, albeit, brings back truncated tweets…


#9

Sounds like you’re not generating the OAuth signature correctly, in that case - what library are you using? Works fine for me using twurl.


#10

Yes, this is all covered in the upcoming changes to Tweets documentation and we will add it to the main docs soon.


#11

Thanks for responding. I’m not using any lib… There was an error in the signature generation, which I fixed and now it goes thru, but, I get nothing back…

here’s the (keys redacted) base string & OAuth header that my OAuth signature is generated from:

Base String:
GET&https%3A%2F%2Fapi.twitter.com%2F1.1%2Fstatuses%2Fuser_timeline.json&count%3D200%26oauth_consumer_key%3D****%26oauth_nonce%3D****%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1475072717%26oauth_token%3D******%26oauth_version%3D1.0%26tweet_mode%3Dextended%26screen_name%3Dtwitterapi

Header:
OAuth oauth_nonce="***", oauth_signature_method=“HMAC-SHA1”, oauth_timestamp=“1475072717”, oauth_consumer_key="*", oauth_token="", oauth_signature="***", oauth_version=“1.0”


#12

Thanks for redacting keys! Anything in the HTTP response headers? Just tried using twurl and this exact same query appears to work there. You could always try running twurl using a trace/verbose mode and comparing your OAuth parameters (it does the heavy lifting for you as it uses the Ruby gem).


#13

Any particular reason you’re adding the oauth tokens in twice, once in the header and once in the query string?

I’d take out the query string version and try it.


#14

It works! I did not do anything different from my last post where I said I was getting a null back… except, that I was working from home for a little bit yesterday… I got in to work this morning and it started to work, (could be a network glitch), it works consistently now. The only thing I imagine was giving the 401 error was the misplaced “tweet_mode” parameter in the signature… seems like it needs to be in the very end with “count” being the first…

It works well for tag searches as well.

Thanks for your time and help!


#15

Hi Richard,
Thanks for responding. I wondered that too, but, this is code that I inherited a few months ago and am not sure. However, i tried to take it away from the query string and left it just in the header and it came up with the 401 error again… I put it back since it is now working… I’m sure I’ll look at it at some point in the future

appreciate the response!


#16

FYI the docs are still not reflecting this change (https://dev.twitter.com/rest/reference/get/statuses/show/id), nor does the API Console (https://dev.twitter.com/rest/tools/console)


#17

The tweet_mode parameter is part of a broader change to the API and we were waiting to complete the update before adding to all of the documentation. Apologies for confusion arising from this.


#18

in twitter rest search api last few days we have empty entities.media or entities.urls even they are not empty.

We also using include_entities = true…

any idea


#19

Are you using tweet_mode=extended?


#20

nope not using tweet_mode=extended.

few weeks ago all was fine . Do we need to use tweet_mode ? when its changed ?