[FFmpeg-user] Getting m3u8 URL from SVTPlay channels?

Moritz Barsnick barsnick at gmx.net
Sat Dec 25 15:53:16 EET 2021


On Sat, Dec 25, 2021 at 12:19:35 +0100, Reino Wijnsma wrote:
> On 2021-12-25T10:13:14+0100, Bo Berglund <bo.berglund at gmail.com> wrote:
> > But on the following pages it does not work at all:
> > https://www.svtplay.se/kanaler/svt1?start=auto

As I had mentioned in the thread previously, it's not given that the
stream URL is embedded in the actual web page. It might be listed in a
JSON file, which might even be referenced from the web page via
JavaScript or similar.

> It's really bad practise to parse HTML with RegEx! It's as if you're using a sledgehammer when you should've been using a pair of tweezers for instance.

For fishing a single URL from a well-known syntactical construct, it
might be "good enough".

> This div is where the magic happens. Take a good look at the
> browser's network-traffic. You're probably going to need the value of
> the "class"-attribute.

And this is what tools like youtube-dl (or its successor yt-dlp) and
svtplay-d do: They know well how to parse these pages, and can extract
the URL for you (check their "-g" options). You don't need to reinvent
the wheel. Unless you need to avoid python. ;)

https://github.com/yt-dlp/yt-dlp/
https://svtplay-dl.se/

(Jeg har faktisk VPN, og jeg har gjort akkurat dette før, med SVT og
lignende.)

Cheers,
Moritz


More information about the ffmpeg-user mailing list