Working with streaming video can sometimes be frustrating, especially when there's a video that's not playing back correctly. You go through the standard steps...you've got plenty of bandwidth, you try different browsers, and then a few different devices. It occurs to you that it might not be the network, there could be something wrong with the video itself. At the very least, you'd like to remove that element of the from the mix so you can rule it out. Now, if you've packaged the video into HLS yourself and you have direct access to the hosting server, doing a little manual "QC" isn't that hard to do. But what if you're using an Online Video Platform or some other type of cloud service? You need a way to download not just the manifest file, but all of the hundreds or thousands of video segments. That's where this Python script comes in.
Set your master m3u8 url as the variable conveniently named masterurl. Set your output directory, and run the script from the command line. For each variant in the master manifest, the script will create a subdirectory and download all the chunks. You're now free to do all of your testing off of your own local server!
You may need to make some adaptations depending on what your manifests looks like. For example, instead of looking for lines that don't have a hash tag, you could look for lines that start with "http" if your paths are not relative.
Finally, once you have everything downloaded to your computer, you might want to look into using ffprobe to validate the video. You'll need to have a local web server running. Then you can run this command:
ffprobe -loglevel 40 -i http://localhost/video/master.m3u8