Syfaro / foxbot

Multiplatform bot for finding furry image sources and more!
https://t.me/FoxBot
MIT License
48 stars 6 forks source link

Twitter images to default #113

Open composingliger opened 2 years ago

composingliger commented 2 years ago

By default Twitter presents images at "medium" size, but it is possible to obtain a higher quality "original" with the :orig name.

Note: Twitter will resize the image at upload time so that no one edge is greater than 4096 px.

It looks like Syfaro/tgbotapi-rs@3bdfa356c51aca7feeccb84e6df520479d9b78fd caused one of the unit tests to start failing, so committed a fix.

Syfaro commented 2 years ago

Hey, sorry about taking so long on getting back to this. I like the idea of fetching higher quality images, but from what I've seen, not every image has an orig quality. To ensure that images always work, there'd probably have to be a check first that the file exists. I can probably add that to this PR when I get a chance.

composingliger commented 2 years ago

Thanks for the reply! I'd forgotten about this PR. (And no worries! - I know people get busy with work/life/other stuff)

Interesting. So most new image URLs seem to be dynamic. For example:

Though there seems to be also image URLs that can't be used this way:

(I wish I could find the original Tweet to see what the API returns for "sizes")

I'm not sure the best place to handle this fallback. Might need to do a HEAD request to check it exists?