Skip to content

Instantly share code, notes, and snippets.

@dardo82
Last active October 16, 2022 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dardo82/8af20494b525c593ca7bee12403f699f to your computer and use it in GitHub Desktop.
Save dardo82/8af20494b525c593ca7bee12403f699f to your computer and use it in GitHub Desktop.
Save $1 secs of RTV38 stream
#! /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