StormyDragon / TwitFix

Fix Twitter video embeds in Discord (and Telegram!)
Do What The F*ck You Want To Public License
11 stars 2 forks source link

Twitter link handling #8

Open StormyDragon opened 2 years ago

StormyDragon commented 2 years ago

We need to proper handle all the types of links that you can retrieve from the twitter UI. Well, not all types, but at least the types where it makes sense to provide a better embed experience than default.

https://t.co/<short link ID> # Unwraps to one of the other links, created by "embed tweet"
https://twitter.com/<user name> # User profile
https://twitter.com/<user name>/status/<tweet id> # Standard tweet
https://twitter.com/<user name>/status/<tweet id>/photo/<digit> # Clicking a photo collection item, or right click copy link address
https://twitter.com/<user name>/status/<tweet id>/video/<digit> # Mobile device embed link (seen failing in logs)
https://twitter.com/i/videos/tweet/<tweet id>?autoplay=1&auto_play=1 # Found in discord Embed Iframe
https://twitter.com/i/user/<user id> # Right click "user liked", redirects to user profile link
https://twitter.com/i/status/<tweet id> # Right click video and copy address.
https://pbs.twimg.com/media/<media id>?format=<fmt>&name=<name> # Right click image, copy image address (no tweet id)
https://twitter.com/hashtag/<tag name>?src=hashtag_click # Hashtag links
https://twitter.com/search?q=<query string>&src=trend_click&vertical=trends # from the right side trends bar (hashtags but not?)