Imagine this: it's Sunday afternoon at 1pm, and you want to watch some live content. But you don't have a TV subscription. So you do a little Googling, and eventually you find yourself on a sketchy website where you can watch the content you're looking for. But while the website has a video player, it's surrounded by advertisements, and probably a cryptominer too. You don't want this website eating your CPU for 2 hours while you're watching your favorite Sunday afternoon content.
Wouldn't it be nice if you could watch that video in VLC instead? Then you can close the sketchy website and still watch your content. It's like having your cake and taking a bite of it too!
Here's how you do it:
-
Capture the m3u8 request in dev tools. Open the site (or just the iframe, if possible) in DevTools and click "play." Search the network tab for
m3u8
and grab the first request. -
Run VLC with command line flags to set the User Agent and Referrer. From the request body, you need to copy the requested URL, the user agent, and the HTTP referrer
Now, open VLC from the command line. If you're on a Mac, your VLC binary is probably located at /Applications/VLC.app/Contents/MacOS/VLC
. You can use the --http-referrer
and --http-user-agent
flags to pass the values you extracted from DevTools to VLC.
For example:
/Applications/VLC.app/Contents/MacOS/VLC \
--http-referrer "https://somesketchysisterwebsiteofgivemesketchystream.eu/" \
--http-user-agent "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/117.0" \
"https://givemesomesketchystream.website/hls/tsn/playlist.m3u8"
This will open VLC, and ensure that it makes HTTP requests to the m3u8 URL with the Referrer
and User-Agent
headers set to the values you provided.
99% of the time, this is sufficient to watch the playlist. It will not work on sites that use a dynamic playlist URL where the key changes every few chunks (typically, these sites have a host page that refreshes the key and updates the URL of the video player). If you encounter one of these, just move onto one of the other sketchy sites. You should find one that works eventually.
P.S. Having trouble opening DevTools? Some of these sites use a trick where they put a debug;
inside an infinite while loop. If you disable breaking on debug
statements, you should be able to avoid getting stuck.