Last active
October 16, 2022 14:59
-
-
Save dardo82/8af20494b525c593ca7bee12403f699f to your computer and use it in GitHub Desktop.
Save $1 secs of RTV38 stream
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/zsh | |
# Saves '$1' secs of the RTV38 stream. | |
URL="webtools\ | |
-845d8509d2cb4f249dd0b2ae5755b6c2\ | |
.msvdn.net/embed/CXHH7K39hg9K/" | |
DATE="$(date +%F)" | |
NAME="RTV38_$DATE" | |
LID=$(curl -L -s "$URL" \ | |
| awk -v FS=': ' '/"live/{print $2}' \ | |
| jq -M -r .liveSourceID 2> /dev/null) | |
M3U8="http://streamcdnb1\ | |
-${${URL%%/*}#*-}\ | |
/live/$LID/${URL##*/}\ | |
/playlist.m3u8" | |
timeout -15 "$1" youtube-dl \ | |
-v -o $NAME $M3U8 | |
mv -v $NAME.{part,mp4} | |
mpv -v $NAME.mp4 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment