Multiple Media Entities in Tweets for the REST API


#30

It says May 28, but help/configuration still returns this:

array (
‘characters_reserved_per_media’ => 23,
‘max_media_per_upload’ => 1,

‘photo_size_limit’ => 3145728,

‘short_url_length’ => 22,
‘short_url_length_https’ => 23,
)

So does the example at https://dev.twitter.com/docs/api/1.1/get/help/configuration.

I also wonder whether statuses/update_with_media can fully replace statuses/update. In other words, with no “media[]”, but everything else exactly the same.

When/if you support multiple files, can each image (and video?) be photo_size_limit large, or are we talking aggregate size of all files per update?

A list of what media types can be uploaded (preferably as MIME type), would be a nice-to-have in help/configuration.

Regards,
Anders


#31

I noticed that a picture link is at least 26 characters long (http(s):// is not shown, so that maybe adds more), while help/configuration returns 23. Is the link actually shorter, but shown in full?

Example (an actual update): “This should be visible at twitter.com/andersborgme twitizer.com/SsIW8 pic.twitter.com/n8FGHIn6Uz

When multiple files are supported, will each URL take up space in the tweet or will it point to a page with all the media (how I solved it in Twitizer)?

Cheers,
Anders


#32

I didn’t even try that, as I assumed I could send only one as help/configuration says so :).

Are more than pictures supported now (like videos and audio)? Any way to determine what media formats are supported?

Has also the picture size limit been changed from 3 MB?

Cheers,
Anders


#33

Any support of extended_entities over stream API?


#34

It does not appear to be there yet.


#35

Were you able to figure this out? I can’t seem to get it to work either


#36

This should be available in the Streaming API after August 25th.


#37

I’m trying to send a POST Request with nodejs but my request fails. Does anybody have a hint?
Tried the following:

Content-Type: multipart/form-data; boundary=---------------------------48870936082676053
-----------------------------48870936082676053
Content-Disposition: form-data; name=“media”; filename="image_5.jpg"
Content-Type: application/octet-stream
Content-Transfer-Encoding: base64

base64 encoded image content
-----------------------------48870936082676053–

But the API responds with “Unknown Twitter API Error” (Status Code 400) “not recognized.”

When using media_data parameter as described in the article (cite: “Note that if you’re uploading a base64-encoded, the param name for this endpoint will be media_data rather than media, which is used for raw images.”)

Content-Type: multipart/form-data; boundary=---------------------------5757786715403199
-----------------------------5757786715403199
Content-Disposition: form-data; name=“media_data”; filename="image_5.jpg"
Content-Type: application/octet-stream
Content-Transfer-Encoding: base64

base64 encoded image
-----------------------------5757786715403199–

The API responds with “Unknown Twitter API Error” (Status Code 409) “media param has zero bytes”


#38

I use “media[]”, not saying that’s the reason for your issues.

You of course need to authenticate with OAuth, but I assume you do that.


#39

Thank you @abiro. Yes I’m using OAuth and had a try with “media[]” but that didn’t work either. I suppose I have to look for an error in my code…

By the way do you POST base64 encoded images?


#40

I use Zend_Oauth_Token_Access and Zend_Http_Client. From what I can see from the latter, it’s in binary as no conversion is made, only the general “MIME magic” is performed.

My code is no doubt working and in a stable way. I filter out too large images (3 MB), so such are not even attempted to send. I also only upload one image, even though supposedly the API supports more. Users have uploaded much larger animated GIFs than 3 MB, but I store all content in my service and link back.


#41

I believe extended entities should now be available in the Streaming API, see https://dev.twitter.com/discussions/30285


#42

I’ve got this working, but why couldn’t this be done with statuses/update_with_media? The media parameter is even an array, and sticking with api.twitter.com would make it easier as well.


#43

I can’t seem to get extended_entities from Search API, is it supported yet? Whereas I’ve no problem getting it from user timeline so I’m guessing access token is not the issue here.

Someone from Twitter please let us know. Thanks.


#44

As et_smpi said, I can also report that I can’t access extended_entities via the Search API for a tweet with multiple photos.


#45

Why can’t I use extend_entities in search API still now?

&ref: https://twittercommunity.com/t/search-tweets-endpoint-and-extended-entities/31655


#46

Hey guys, I am basically new to scraping for Twitter Data, and I wanted to know, how do I tell the difference between the “Media entitiy” and the “Extended Entities”. For example, if somebody posts 2 photos with a Tweet, would photo 1 info be in the media entity and the photo 2 with the extended entity? What about mp4, etc. ? Please let me know if I seem to be asking a confusing question.


#47

The first media item - specifically an image - would be in the media entity section. Everything else - more images, animated gifs, or videos - would be in the extended entities.


#48

Dear Mr. Piper, You’re a champ!


#49

I found that in some tweets there is missing media entities. 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?