Guide to ripping HLS streams using aria2 and ffmpeg
Dependencies:
Setup:
- Create a folder for the movie you want (i.e. pppd-369)
- Open up the web player for the movie.
- Click
F12
on your keyboard. (opens Developer Tools) - Switch the streaming bitrate from AUTO to 6000kbps.
- Go to the
Network Tab
in dev tools and search filter for.m3u8
. - Download the
chunklist_b6000000
file by right clicking and open in new tab. - Save it to the folder as index.m3u8.
- Now filter for
mobile
(ordrm_iphone
) and download the file. This is important for decrypting the ts files we will download soon. - Open up index.m3u8 in VS Code or your favorite text editor.
- Edit the URI to simply be
mobile
ordrm_iphone
(the file we downloaded above).
Your file should look like this at the top:
#EXT-X-KEY:METHOD=AES-128,URI="mobile"
#EXTINF:10.0,
media_b6000000_0.ts
#EXTINF:10.0,
media_b6000000_1.ts
#EXTINF:10.0,
media_b6000000_2.ts
#EXTINF:10.0,
...
- Save the file.
- Lastly, note the number of the last
_#.ts
file at the bottom of index.m3u8. Let's call itEND_TS
.
Download via aria2:
- Back in your network tab filter for
.ts
and highlight the request URL for any of your matches. - Copy the string up until
media_b6000000_
and paste in your notes then concatenate with[0-END_TS].ts
.
Example:
http://limst-video7.*.com*/media_b6000000_[0-1770].ts
- Next, open up your command line terminal and cd into the folder with the m3u8 file. Run the following command with the URL we created above.
aria2c -P -Z -c -x 5 -j 5 <URL>
This will open 5 connections at a time and download each individual ts file listed in the m3u8
file.
- Once complete run the following command to join and decrypt the ts files into one mkv file that we will save outside the folder so we can easily find it when complete:
ffmpeg -allowed_extensions ALL -i index.m3u8 -c:v copy -c:a copy ../pppd-369.mkv
And that's everything.