Guest User

Untitled

a guest
May 25th, 2020
95
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. cd "$(dirname "$0")"
  4. mkdir stream_archives
  5. cd stream_archives
  6. mkdir $2
  7. cd $2
  8. touch wanin.txt pars.txt parshistory.txt
  9.  
  10. sheetrss=$(wget -O - -o /dev/null https://www.youtube.com/feeds/videos.xml?channel_id=$1)
  11.  
  12. parsv=$(sed -n '1p' \
  13. <<< $(sed -rn 's/\s*<link rel=\"alternate\" href=\"(https:\/\/www.youtube.com\/watch\?v=\S{11})"\/>/\1/p' \
  14. <<< $sheetrss))
  15.  
  16. if [ "$(echo $parsv)" != "" ]
  17. then
  18.   date >>wanin.txt
  19.   if [ "$(cat pars.txt)" = "" ]
  20.   then
  21.     echo $parsv >pars.txt
  22.     echo $parsv >parshistory.txt
  23.   fi
  24.   if [[ ("$(echo $parsv)" != "$(cat pars.txt)") && ("$(echo $parsv)" != "$(cat parshistory.txt)") ]]
  25.   then
  26.     sed -n '2p' \
  27.     <<< $(sed -rn 's/\s*<link rel=\"alternate\" href=\"(https:\/\/www.youtube.com\/watch\?v=\S{11})"\/>/\1/p' \
  28.     <<< $sheetrss) \
  29.     >parshistory.txt
  30.     echo $parsv >pars.txt
  31.     case $2 in
  32.       "touhou") timezonev=$(echo TZ=\":Asia/Tokyo\");;
  33.       *) timezonev=$(echo);;
  34.     esac
  35.     datev=$($timezone date +%Y-%m-%d_%Hh)
  36.     titlev=$(sed -n '1p' \
  37.     <<< $(sed -rn 's/\s*<media:title>(.+)<\/media:title>/\1/p' \
  38.     <<< $sheetrss))
  39.     titlevf=$(echo $2 $datev$titlev)
  40.     sed -r 's/<media:description>//; s/<\/media:description>//; 0,/\s*(.*)/{s/\s*(.*)/\1/}' \
  41.     <<< $(awk '/media:description/{f++} f; f>1 {exit}' \
  42.     <<< $sheetrss) \
  43.     >"$titlevf".txt
  44.     streamlink --retry-streams 20 --retry-max 540 -o "$titlevf".ts $parsv best >>wanin.txt
  45.   fi
  46. fi
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×