How To Download m3u8 videos from Twitter

How To Download m3u8 videos from Twitter
By Chongchen Saelee

If you’re browsing websites like Twitter or Facebook, you may notice videos may not be accessible for download. Back in the day, it was quite easy because the actual video file is embedded right into the page. These days, with privacy concerns (and copyright issues), Internet videos are becoming harder to “save for offline viewing”. But with a little know-how, you could successfully save these videos for offline viewing. After all, the data has to be sent to your computer anyway.

So particularly for m3u8 file format, which is just a plain text file that includes a playlist of urls to source videos (and sometimes other playlists), what you’re looking for are ts video source urls. Of course, you have to track down the url of the m3u8 file first. In Google Chrome, there is the very helplful “inspect” tool in the Developer Tools menu. Or, if it hasn’t been obfuscated, you can right-click on the part of the webpage where the video will render and click on “Inspect” if that option is enabled. Then you want to track down that url for the m3u8 file. Download the m3u8 file and open it with a plain text editor like Notepad.

In the m3u8 file, locate any ts file urls. Sometimes the m3u8 file contains a list of other m3u8 urls, so you might have to keep digging. But your goal is to find those downloadable video formats, in this case, ts video format.

If you’ve successfully located the m3u8 file with all the ts file urls, note you’ll have to download every ts file because they may be segmented.

If those ts files are segmented, you’ll have to join them all to get a single viewable video (if you don’t like the headache of jumping videos in a playlist).

This isn’t the recommended way, but you can create a simple Windows .bat file using this script to join your ts videos:

copy /b *.ts joined_files.ts

Open a plain text editor like Notepad and paste that command inside. Save As a .bat format file. Copy the .bat file into a folder containing all the downloaded ts videos. As long as the ts videos are named in sequential order with numbers (highly recommended), this .bat file should join them in order. Double click on the .bat file to join the ts videos into one video.

That’s it! I tested it myself. It works (technically, it does, I’m just going to warn that on the binary level, I don’t know if it’s properly formatted, so don’t try it with other video formats other than ts). Hope it helps you.

My references:

Tags: , , , , , , , , , , ,

Comments are closed.