How to save gif's on Twitter???

fezzie

Active Member
Jan 26, 2013
40
181
Been surfing twitter lately and there are some awesome gifs posted here and there. Not the 5 second ones you often see on many sites, but 20 or 30 second ones - even longer.

I tried right-clicking but nothing comes up that works. Anyone have any experience with this?

Thanks,
Fezzie
 

CoolKevin

Nutcase on the loose
Staff member
Super Moderator
Mar 30, 2007
10,005
3,633
not seen them myself, but if you are using firefox you can get extensions like video downloader, not sure what would be best for twitter, but this is a start
 
  • Like
Reactions: fezzie

SamKook

Grand Wizard
Staff member
Super Moderator
Uploader
May 10, 2009
3,755
5,154
I took a quick look and the "gif" seem to actually be mp4 files.

Using firefox and jdownloader2, I right-click them, click Select All, copy them and jdownloader2 will detect them and allow you to download the jpg thumbnail and the mp4.
 

fezzie

Active Member
Jan 26, 2013
40
181
Yes, you are correct, many of them are in fact mp4's, but there are also a lot of gifs too. If its an mp4 there is a circle with a play arrow in the middle, if its a gif it says so on the lower left corner.

I should have mentioned that I use Opera for a browser, I tried what you said but that method didn't work for me. I guess thats a Firefox thing. Right clicking and saving photos works fine, but not gifs or mp4's

But I appreciate the help anyway
 

CoolKevin

Nutcase on the loose
Staff member
Super Moderator
Mar 30, 2007
10,005
3,633
even opera must have extensions for downloading, usually the same ones for all browsers
 

SamKook

Grand Wizard
Staff member
Super Moderator
Uploader
May 10, 2009
3,755
5,154
I took a closer look and apparently, the gif(with the gif tag on the bottom left) are displayed as mp4(local on twitter website) unless you open the post(try to open it in a new tab instead of using the popup window). Then you get the actual gif from the original source.

Using chrome(which is basically the same thing as the new opera), once the post is open, you can click on the gif which will bring you to the original source website and you'll be able to save it from there or you can right click and copy the link to let jdownloader2 download it.
Since that doesn't seem to be possible for every post(I'm not that familiar with twitter), you can also manually select it with your mouse and press ctrl+c to copy it, but it's hard to select only one so you might get a bunch of them.

If this doesn't work for you, give me a link as an example and I'll check it out.


And as coolkevin mentioned, I'm sure there are plenty of addons that can do the job.
 
Last edited:
  • Like
Reactions: CoolKevin

fezzie

Active Member
Jan 26, 2013
40
181
Here is the "Japan Girl" page: https://twitter.com/sexy_hot24/media
You will see the first several posts are pics or gifs, then around a dozen posts down there is an mp4 (I think b/c there is a time counter).

There are tons of twitter accounts like this

Thanks very much for your input!
 

SamKook

Grand Wizard
Staff member
Super Moderator
Uploader
May 10, 2009
3,755
5,154
Did a bit of research and apparently, twitter converts all the gif to mp4 so if it doesn't bring you to an external website where you can download it, you're stuck getting the mp4.

To get it, right-click the date in the top right corner of the post, copy the link and paste it in a downloader compatible with twitter(for example, jdownloader2 which what I use and paste it automatically when copied but you can also look up some addons to opera that can do the job).

Not all gif are created equal on twitter apparently, but that method works for that link at least.

You can also convert the mp4 to an actual gif, but you'll lose some quality when doing so(not that gif quality is good to begin with), here's a page that explains how: http://loopagain.com/how-to-save-a-gif-from-twitter/
 

kunoichi

Occasional Visitor
Mar 26, 2007
622
2,247
I did a little research, it turns out they are stored as 3 second Transport Stream files using AVC/AAC encoding for video/audio.

If you press F12 in most browsers you can bring up the Developer Tools. In firefox you can press the icon to the left and hoover/click an element on the page to see the actual html code.

1.png

Scroll up a bit and find the DIV with playerContainer as ID. The data-config attribute of the div can be expanded and it contains the JSON variables, including the URL that configures the player.

2.png

To make the JSON more readable, you can put it into some online json viewer, for example:
http://codebeautify.org/jsonviewer
If you press beautify you can see the content more readable to the right.

3.png

You will notice that the video_url is actually a playlist:
Code:
https://video.twimg.com/ext_tw_video/806523101378772992/pu/pl/CvL38VeYPx1gKfX2.m3u8

If you open the file with a text editor like Notepad++:
Code:
#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=256000,RESOLUTION=240x240,CODECS="mp4a.40.2,avc1.42001f"
/ext_tw_video/806523101378772992/pu/pl/240x240/GJpKyOeG285Z4nUK.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=832000,RESOLUTION=480x480,CODECS="mp4a.40.2,avc1.42001f"
/ext_tw_video/806523101378772992/pu/pl/480x480/Fhoj2MWs1hbj9F88.m3u8

The playlist is actually just an url-list of playlists with different resolution. in this case 240x240 and 480x480.

However, the domain is stripped so the 480x480 url would actually be:
Code:
https://video.twimg.com/ext_tw_video/806523101378772992/pu/pl/480x480/Fhoj2MWs1hbj9F88.m3u8

Downloading the file and again open with Notepad++:
Code:
#EXTM3U
#EXT-X-VERSION:6
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-TARGETDURATION:3
#EXT-X-ALLOW-CACHE:YES
#EXTINF:3.000,
/ext_tw_video/806523101378772992/pu/vid/0/3000/480x480/zp2XfNNE9F1rII5b.ts
#EXTINF:3.000,
/ext_tw_video/806523101378772992/pu/vid/3000/6000/480x480/7ViunPjQRKOiSqQy.ts
#EXTINF:3.000,
/ext_tw_video/806523101378772992/pu/vid/6000/9000/480x480/WlXU-MZbn4hCuSVR.ts
#EXTINF:3.000,
/ext_tw_video/806523101378772992/pu/vid/9000/12000/480x480/WJ0l9z_nN8rLBJnC.ts
#EXTINF:3.000,
/ext_tw_video/806523101378772992/pu/vid/12000/15000/480x480/DaSNLQr5CI8DYkLW.ts
.
.
.

Let's take the first url and add domain:
Code:
https://video.twimg.com/ext_tw_video/806523101378772992/pu/vid/0/3000/480x480/zp2XfNNE9F1rII5b.ts

You can download the .ts file and play with mpc or vlc, but it's only the first three seconds.

In theory you could probably download all parts and merge them, but using a downloader or website is of course a lot easier. :)

It is also possible that there are other links to the files where you stream the complete file directly, but you would have to listen to network traffic urls or study the javascript for the player.


Finally, this video is a few years old but still valid and very interesting: