# Generally, you can add the URL after invoking the script (e.g. # I DID NOT WRITE ANY SAFETY CHECKS INTO THIS SCRIPT. # I am not liable if this script ruins or damages your computer, etc. Here’s a short script I wrote that should do it all in one shot. amplify_video/1234567/vid/33000/36000/1280x720/jsuneusl23ggg.tsĪt this point I wrote a script to accept a URL to a Twitter m3u8 file (which I usually get via Chrome web developer tools) as an argument, then proceed to run a subshell and download each “.ts” file to a download directory, and then run another subshell to concatenate all video files into a “.mp4” file and move it to a folder in my user’s “Downloads” directory. Upon inspecting this file, I saw that there were several relative paths to “.ts” files, which are segments of the complete video (see an abridged example below) $ curl -silent From there on, I chose the URI I want to use to download the video. amplify_video/123456789010111213/pl/1280x720/jsuND9234KAOdks.m3u8Īs you can see, the file is listing multiple dimensions (resolutions) and network speeds (bandwidth) which my device will automatically choose from.
When you click “Play” on a video on Twitter, your web browser (on your phone or desktop) essentially asks Twitter for a small file that contains addresses to small, medium, and large versions of the video you’d like to play.
But first, let’s try to understand what happens when you load a Tweet that contains a video player, or rather, a thumbnail with a “Play” button on top. Today I will share with you how I downloaded a video from Twitter. I’ve updated my script to be more concise.
Update 2: Twitter has made more changes to their m3u8 file format. For reasons of which one would still like to learn about downloading m3u8 videos and stitching them together, I’m leaving this up. The URL is only able to be decoded by the user’s web browsing device and cannot be “CURL’d” by a command line. They are now using a JavaScript method that obfuscates the video URL via a blob mechanic. Update 1: It appears that Twitter has changed their scheme in how they display videos.