tweet.entities.media[0].media_url is for image png and jpg tweet.extended_entities.media[0].video_info.variants[0].url is for the video mp4
But I want to know how I can get the animated gif not video
Animated GIFs are transcoded to MP4 on upload, so there’s no way to retrieve the original GIF, just the MP4 version that Twitter uses to play the animation.
Ah, I hope that changes in the future. Thanks for the help.
There are no plans to change our media pipeline. You can keep an eye on the API roadmap here.