On 2021-12-25T10:13:14+0100, Bo Berglund <bo.bergl...@gmail.com> wrote: > CMD="curl -s \"${STREAMURL}\" | grep -o -e \"https://.\+m3u8\" | head -n 1" > M3U8=$(eval $CMD) > if [ -z $M3U8 ]; then > RESULT=1 > echo "Error, no response!" > else > RESULT=0 > eval "echo ${STREAMURL} ${M3U8} > ${URLFILE}" > echo "Done, result in ${URLFILE}: ${STREAMURL} ${M3U8}" > fi > exit ${RESULT} > > [...] > > But on the following pages it does not work at all: > https://www.svtplay.se/kanaler/svt1?start=auto 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.
- Why it's not possible to use regex to parse HTML/XML: a formal explanation in layman's terms <https://stackoverflow.com/q/6751105> - RegEx match open tags except XHTML self-contained tags <https://stackoverflow.com/q/1732348> - How do I extract data from an HTML or XML file? <https://mywiki.wooledge.org/BashFAQ/113> Use the right tool for the job, use an HTML/XML parser, like Xidel <http://videlibri.sourceforge.net/xidel.html>! And besides, you're extremely lucky if this has worked for you this far, because nowadays it's pretty rare to find m3u8-urls that easily in the HTML-source. It appears the video will only play if you're a Swedish citizen, so you have to do this yourself. $ xidel -s "https://www.svtplay.se/kanaler/svt1?start=auto" -e '//div[@data-testid="videoplayer"]' --output-node-format=xml --output-node-indent <div data-rt="video-player-channels" data-testid="videoplayer" class="sc-608300a9-0 dwSuQH"> <div class="_video-player_qoxkq_1 _video-player--16-9_qoxkq_1"> [...] </div> </div> 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. -- Reino _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".