corebird icon indicating copy to clipboard operation
corebird copied to clipboard

Support adding image descriptions

Open lucaswerkmeister opened this issue 8 years ago • 5 comments

Twitter allows you to add descriptions (alt text) to images, to improve accessibility. It would be great if this client supported that as well.

lucaswerkmeister avatar Feb 10 '17 21:02 lucaswerkmeister

They do not allow that from their public REST API as far as I can see, https://blog.twitter.com/2016/alt-text-support-for-twitter-cards-and-the-rest-api mentions a 1.1/media/metadata/create.json endpoint for which "documentation [...] will soon be published", but https://dev.twitter.com/rest/reference still doesn't list it.

baedert avatar Feb 11 '17 06:02 baedert

@baedert I'm no dev, but it seems like twurl succesfully implemented it. Is that the way you can do it as well? (again: I'm no dev so I don't know whether this'll work or not) https://twittercommunity.com/t/alt-text-support-in-twurl/64391/5

Vistaus avatar Feb 11 '17 11:02 Vistaus

Umm, I don't know if that works or not, https://dev.twitter.com/rest/reference/post/media/metadata/create looks like some unfinished placeholder site (and it even links to a chunked media upload endpoint that doesn't officially exist...?)

baedert avatar Feb 11 '17 11:02 baedert

The twitter.com website seems to do mostly the same thing as twurl – this was POSTed to /i/media/metadata/create.json when I sent a tweet with a described image:

{"media_id":"830402076324794368","alt_text":{"text":"Two Agents Smith"}}

Same JSON as in comment #​5 there (modulo whitespace).

Also, the body of the subsequent POST request to /i/tweet/create contained &has_alt_text=true (along with the media ID).

lucaswerkmeister avatar Feb 11 '17 13:02 lucaswerkmeister

It looks like the required API is now properly documented on https://developer.twitter.com/en/docs/media/upload-media/api-reference/post-media-metadata-create:

Call this endpoint to attach additional metadata such as image alt text.

POST https://upload.twitter.com/1.1/media/metadata/create.json

{
  "media_id":"692797692624265216",
  // image alt text metadata
  "alt_text": {
    "text":"dancing cat" // Must be <= 420 chars
  }
}

lucaswerkmeister avatar Nov 19 '17 12:11 lucaswerkmeister