How to download a Twitter video from a DM
Recently, Twitter rolled out a new design for the majority of their users. The new design features re-arranged buttons and a sidebar on the left. Also, the new design made it harder for some folks to download a video from DMs. In this post we will review a relatively simple trick that will allow you to download any video from a Twitter DM.
Twitter is a popular social network which allows posting short messages. The length of the post is only 140 280 characters, excluding links and images. Twitter is used by millions of people, including celebrities and public figures to share what's on their mind, useful information and announcements, and various personal events. Twitter supports private messaging, user mentions, emojis and hotkeys. Besides the web site, users are able to use it via a number of Twitter clients available for all major platforms.
Prerequisites
The browser
To be able to download a video from a DM, you need a browser with Developer Tools integrated. Luckily, all modern browsers comes with such an option. I will use Google Chrome, which allows opening Developer Tools with the Ctrl + Shift + I hotkey.
Youtube-dl
Another thing we need is youtube-dl
, a cross-platform command line tool that allows downloading and converting videos on the fly from various web sources, including Twitter. In fact, the list of supported services by the app is really HUGE.
Grab youtube-dl and its dependencies from HERE. If you are a Linux user, there's a great chance that you already have it available in the package repository.
The youtube-dl app is a portable tool that doesn't require installation. Just download it to a convenient location. I will place the it under C:\apps\youtube-dl\youtube-dl.exe. Don't forget to install Microsoft Visual C++ 2010 Redistributable Package (x86) as mentioned on the download page.
FFmpeg
Yet another tool is required to assist youtube-dl. To merge the downloaded video fragments (Twitter splits videos into pieces for faster streaming), it needs FFmpeg. Windows builds can be obtained HERE.
I suggest you to download 32-bit static build of FFMpeg binaries. Here is the actual direct link at the moment of writing.
Extract the contents of the bin folder to the c:\apps\youtube-dl folder to get all the ffmpeg windows binaries stored under the same folder.
Now, let's grab some video from Twitter DMs.
To Download a Video From Direct Message on Twitter,
- Open a command prompt in the folder where you have youtube-dl and leave it open.
- Open Twitter in Google Chrome and sign-in to your account.
- Switch to Direct Messages and open the conversation you want to download a video from.
- Press CTRL+SHIFT+I to open Developer Tools in Chrome and switch to the Network tab.
- Type
.m3u8
in the Filter box. - In the list below, right-click on the row in the Name column, and select Copy link address. Start from the last row (see below).
- Switch back to the command prompt. Type
youtube-dl <past the copied link address here>
. - Hit the Enter key and wait. Youtube-dl will download the video and save it as MP4 to its folder (C:\apps\youtube-dl in my case).
- Now, copy the link address for the next m3u8 entry, and download the video.
- Repeat the steps for other m3u8 links. This will give you all possible resolutions of the video available on Twitter.
You are done! The biggest file usually retains the highest quality available. Check out all the files and pick the one which plays best for you.
Note: From our observation, the last m3u8 link in the list points to the stream of highest quality. So, if you start with the last line, there is a chance that you will get the best video quality available directly.
Tip: You can follow Winaero on Twitter. Also, you can follow my personal account: Sergey Tkachenko on Twitter.
Thanks to Roman Linev for his assistance and suggestions.
Articles of interest:
Support us
Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:
Thanks! Does this way work for any video streaming service download?
yep, if it is supported by youtube-dl
The following is far easier, no need to download anything or search inspection mode
https://www.savetweetvid.com/
and how it will help you to get a video from a DM?
that the issue i have here:
C:\Users\ADUNIIS>youtube-dl https://video.twimg.com/dm_video/1177638976620056577/pl/zV2sF_cmBpUjVPdtw2aSIIxWGZmgSHjSKJVaZqIsQhI.m3u8?tag=1
‘youtube-dl’ is not recognized as an internal or external command,
operable program or batch file.
Are you sure you have
youtube-dl.exe
in the folderC:\Users\ADUNIIS
?Hello! Things were going pretty well but I’ve gotten a permission denied error.
I’ve started running into similar issues as noted by JT above – I get an error that an image can’t be loaded because it violates the security policy directive. However, the “image” it references is an ad. I’m also getting an error that DevTools is unable to parse the sourcemap. I wonder if this is because of the new Twitter UI, or because the video was posted in a group DM by someone who has set their account to private?
Is there a way to do this on macOS?
Must be this:
I am unable to download this vide which I received via Twitter direct message. Can you please download and send to my mail id or tweet to @sgbalaji200 plz
I am unable to download this video which I received via Twitter direct message. Can you please download and send to my mail id or tweet to @sgbalaji2000 plz
ou can use Homebrew if you have it:
brew install youtube-dl