How to download videos from Twitter (X) and save them locally under Linux - Simple Method

You will need two tools to download videos from twitter under linux:

  • Your browser
  • yt-dlp

# yt-dlp

yt-dlp stands for youtube downloader. Originally intended to download Youtube videos only, now it can be used for only for Youtube and Twitter, but many more services. In the past, there were other developments and forks (opens new window) with same or similar name, but i find the following, the fastest, frequently updated and most stable of all. You can find it at: https://github.com/yt-dlp/yt-dlp (opens new window)

Installation:

The most painless and user-friedly way to install it, is just to download the binary:

Just go to: https://github.com/yt-dlp/yt-dlp/tags (opens new window)

Choose the version you like, usually the latest. Click on yt-dlp_linux filename. Your download will start shortly. (Note: there is also arm version, so be careful not to download the wrong file!)

Make the saved file executable. And thats it - yt-dlp_linux is installed and ready to be used on your linux system.

You can move the downloaded binary inside folder, included in your "PATH" variable, so you be able to just :

$ yt-dlp_linux ...

in console. Me personally, i prefer to keep such standalones in my Downloads folder and use them as:

$ ~/Downloads/Software/yt-dlp_linux ....

# Now, to the twitter video download:

Lets take this video for example: https://twitter.com/elonmusk/status/1748094375869993228 (opens new window)

  1. Right click on the video -> click on "Copy video address":

twitter save video copy video link


  1. Open browser "Developer tools":
    1. Chrome: F12 or Shift + Ctrl + J
    2. Firefox: F12
    3. Vivaldi - F12
    4. Other - look at the specific browser documentation

download video from twitter using browser


  1. Click on Network tab
  2. Refresh the page, while "Developer tools" is opened
  3. In the search box type m3u8:

twitter download video m3u8 file


  1. Using right mouse click on the first .m3u8 file, choose "Copy link address"

use m3u8 file to download video from twitter


  1. Use yt-dlp_linux as:
$ /path/to/yt-dlp_linux "https://video.twimg.com/ext_tw_video/1748077028539236352/pu/pl/928lu3S8c6yZHe8e.m3u8?variant_version=1&tag=14&container=fmp4"

twitter video download save mp4 ready


Done.


Bye 😃