Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- cd "$(dirname "$0")"
- mkdir stream_archives
- cd stream_archives
- mkdir $2
- cd $2
- touch wanin.txt pars.txt parshistory.txt
- sheetrss=$(wget -O - -o /dev/null https://www.youtube.com/feeds/videos.xml?channel_id=$1)
- parsv=$(sed -n '1p' \
- <<< $(sed -rn 's/\s*<link rel=\"alternate\" href=\"(https:\/\/www.youtube.com\/watch\?v=\S{11})"\/>/\1/p' \
- <<< $sheetrss))
- if [ "$(echo $parsv)" != "" ]
- then
- date >>wanin.txt
- if [ "$(cat pars.txt)" = "" ]
- then
- echo $parsv >pars.txt
- echo $parsv >parshistory.txt
- fi
- if [[ ("$(echo $parsv)" != "$(cat pars.txt)") && ("$(echo $parsv)" != "$(cat parshistory.txt)") ]]
- then
- sed -n '2p' \
- <<< $(sed -rn 's/\s*<link rel=\"alternate\" href=\"(https:\/\/www.youtube.com\/watch\?v=\S{11})"\/>/\1/p' \
- <<< $sheetrss) \
- >parshistory.txt
- echo $parsv >pars.txt
- case $2 in
- "touhou") timezonev=$(echo TZ=\":Asia/Tokyo\");;
- *) timezonev=$(echo);;
- esac
- datev=$($timezone date +%Y-%m-%d_%Hh)
- titlev=$(sed -n '1p' \
- <<< $(sed -rn 's/\s*<media:title>(.+)<\/media:title>/\1/p' \
- <<< $sheetrss))
- titlevf=$(echo $2 $datev /$titlev)
- sed -r 's/<media:description>//; s/<\/media:description>//; 0,/\s*(.*)/{s/\s*(.*)/\1/}' \
- <<< $(awk '/media:description/{f++} f; f>1 {exit}' \
- <<< $sheetrss) \
- >"$titlevf".txt
- streamlink --retry-streams 20 --retry-max 540 -o "$titlevf".ts $parsv best >>wanin.txt
- fi
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement