FixTweet / FxTwitter

Fix broken Twitter/X embeds! Use multiple images, videos, polls, translations and more on Discord, Telegram and others
https://fxtwitter.com
MIT License
2.62k stars 77 forks source link

API docs: add `APITweet.media.all`, `APIPhoto.altText` #507

Open Deer-Spangle opened 11 months ago

Deer-Spangle commented 11 months ago

Hey there,

Just noticed both of these are missing from the api docs on the wiki: https://github.com/FixTweet/FixTweet/wiki/Status-Fetch-API

I guess APITweet's media.all is just the list of all media? Combining both photos and videos, in case they have order. But does it include the website previews? I would guess not? But I didn't manage to find an example in a quick delve into that place.

And I noticed altText isn't listed on there for APIPhoto either. And a lot of fields are missing from APIAuthor

I'm not sure whether anything else is missing, though I was wondering what the heck is up with that created_at format? Is that some standard American format? I would have expected ISO8601, but I think I can work with whatever.

Also, curious what the API reports for gifs, which are a separate media type in the twitter API, iirc? I'm not sure if those still exist, and couldn't find an example with a quick glance!

Many thanks once again!

dangeredwolf commented 11 months ago

created_at uses js date formatting which comes directly from Twitter API. I'm still working on v2 of API which also includes threads and other data providers <.<

Deer-Spangle commented 11 months ago

Is it JS date formatting? When I try in console, JS puts the year before the time, but the API seems to put it afterwards?

>>> d = new Date()
Date Wed Nov 22 2023 13:29:46 GMT+0000 (Greenwich Mean Time)
>>> d.toString()
"Wed Nov 22 2023 13:29:46 GMT+0000 (Greenwich Mean Time)"
>>> d.toGMTString()
"Wed, 22 Nov 2023 13:29:46 GMT"
>>> d.toISOString()
"2023-11-22T13:29:46.571Z" 

Where the API gives something like Wed Nov 22 13:29:46 +0000 2023 But yeah, fair enough, it's whatever. I can handle that. (For v2 reference, please return timestamps in ISO8601 format!)

Searched and found a twitter gif, and looks like the API supports it as an mp4 and lists in videos, as expected: https://api.fxtwitter.com/AMUMA_amuma/status/1727282721276514331 cool

So yeah, remaining question to clarify: APITweet's media.all is just the list of all media in order right, in case there's a mix of photos and videos?

I tried to delve in and find an example tweet, but didn't succeed. Did find whatever this is, which displays on twitter as an image, but is a link to instagram? But doesn't include the link in the visible text... but then the fxtwitter API includes the link in the text, doesn't have a media key at all, would have expected empty or media.external https://api.fxtwitter.com/PrinceMixedMazi/status/1724874359662403995

Also, what do you mean by other data providers?

dangeredwolf commented 10 months ago

By other data providers I meant Mastodon (activitypub) and Bluesky. And yes, media.all is mixed videos and photos

manhict commented 10 months ago

I see a note to read non-public urls like Nsfw, can this be done without an account cookie?

For example: When I try running that with the api at: https://api.fxtwitter.com/status/1663282281488760834 ["code": 200,"message": "OK",]

http://localhost:8787/status/1663282281488760834 ["code": 404,"message": "NOT_FOUND","tweet": null]