diff --git a/webroot/watch.shs b/webroot/watch.shs
index 2c4f02e..c02cf69 100755
--- a/webroot/watch.shs
+++ b/webroot/watch.shs
@@ -7,103 +7,67 @@ fi
declare -A strings
-#if [[ ! "$(which haruhi-dl)" ]]; then
-# strings[error]='Could not load video'
-# source templates/head.sh
-# source "${cfg[namespace]}/templates/header.shs"
- # render strings "${cfg[namespace]}/templates/themes/${cfg[template]}/watch_error.t"
-# return
-#fi
-
if [[ "${get_data[v]}" ]]; then
- if [[ "${get_data[v]}" == '18l' || "${get_data[v]}" == '5eFdt6Y_34E' ]]; then
- strings[uploader]='MyMusicGroup'
- strings[title]='█▬█ █ ▀█▀ Jeden Osiem L - Jak Zapomnieć (Oficjalny Teledysk)'
- formats='[{
- "format_id": "44",
- "url": "https://sakamoto.pl/tmp/videoplayback_.webm",
- "asr": 44100,
- "format_note": "480p",
- "fps": 25,
- "height": 480,
- "tbr": 867,
- "width": 640,
- "ext": "webm",
- "vcodec": "vp8",
- "acodec": "vorbis"
- }]'
- subs='[]'
- if [[ "${r[host]}" == "${cfg[flash_host]}" ]]; then
- url='http://f.sakamoto.pl/videoplayback_.flv'
- fi
- if [[ ${cfg[template]} != 'retro' ]]; then
- meta[title]="${strings[title]}"
- #source templates/head.sh
- source "${cfg[namespace]}/templates/header.shs"
- fi
- else
- cd temp
- video=$(yt-dlp --all-subs --write-pages --cookies "${cfg[_cookies]}" -J "http://youtube.com/watch?v=${get_data[v]}")
- if [[ $video == '' ]]; then # okay who did this
- random_hash=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 24 | head -n 1)
- video=$(yt-dlp --all-subs --write-pages --cookies ${cfg[_cookies]} -J "http://youtube.com/watch?v=${get_data[v]}" 2> output$random_hash.log)
- if [[ $video == '' ]]; then # seriously WHO DID THIS
- if [[ "${cfg[regionlock_proxy]}" == true ]]; then
- # retrying w/ proxy!
- video=$(yt-dlp --all-subs --write-pages --cookies ${cfg[_cookies]} --proxy "${cfg[regionlock_proxy_url]}" -J "http://youtube.com/watch?v=${get_data[v]}" 2> output$random_hash.log)
+ cd temp
+ video=$(yt-dlp --all-subs --write-pages --cookies "${cfg[_cookies]}" -J "http://youtube.com/watch?v=${get_data[v]}")
+ if [[ $video == '' ]]; then # okay who did this
+ random_hash=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 24 | head -n 1)
+ video=$(yt-dlp --all-subs --write-pages --cookies ${cfg[_cookies]} -J "http://youtube.com/watch?v=${get_data[v]}" 2> output$random_hash.log)
+ if [[ $video == '' ]]; then # seriously WHO DID THIS
+ if [[ "${cfg[regionlock_proxy]}" == true ]]; then
+ # retrying w/ proxy!
+ video=$(yt-dlp --all-subs --write-pages --cookies ${cfg[_cookies]} --proxy "${cfg[regionlock_proxy_url]}" -J "http://youtube.com/watch?v=${get_data[v]}" 2> output$random_hash.log)
+ fi
+ output=$(cat output$random_hash.log)
+ rm output$random_hash.log
+ if [[ $video == '' ]]; then
+ if [[ $output == 'ERROR: Video unavailable' ]]; then
+ strings[error]='Video unavailable'
+ elif [[ $output == *'ERROR: Incomplete YouTube ID'* ]]; then
+ strings[error]='Incomplete YouTube ID'
+ else
+ strings[error]='Unexpected error has occured'
fi
- output=$(cat output$random_hash.log)
- rm output$random_hash.log
- if [[ $video == '' ]]; then
- if [[ $output == 'ERROR: Video unavailable' ]]; then
- strings[error]='Video unavailable'
- elif [[ $output == *'ERROR: Incomplete YouTube ID'* ]]; then
- strings[error]='Incomplete YouTube ID'
- else
- strings[error]='Unexpected error has occured'
- fi
- cd ..
- source "${cfg[namespace]}/templates/header.shs"
- render strings "${cfg[namespace]}/templates/themes/${cfg[template]}/watch_error.html"
- return
- fi
- fi
- fi
- cd ..
- strings[channel_id]=$(jq -r '.channel_url' <<< "$video" | sed -s 's/.*\/channel\///')
- strings[uploader]=$(jq -r '.uploader' <<< "$video")
- strings[title]=$(jq -r '.title' <<< "$video")
- if [[ ${cfg[template]} != 'retro' ]]; then
- meta[title]="${strings[title]}"
- meta[description]="$(jq -r '.description' <<< "$video")"
- meta[unsafe]="
-
-
-
- "''
- #source templates/head.sh
- source "${cfg[namespace]}/templates/header.shs"
- fi
- formats=$(jq -c '[.formats[] | {"format_id":.format_id,"url":.url,"ext":.ext,"width":.width,"height":.height,"format_note":.format_note,"acodec":.acodec,"vcodec":.vcodec,"abr":.abr,"fps":.fps}]' <<< "$video")
-
- sub_array=()
-
- for i in $(jq -r '.subtitles | keys[]' <<< "$video"); do
- sub_array+=("$(jq '.subtitles.'"$i"'[] | select(.ext == "vtt").url | {"url": ., "lang":"'"$i"'"}' <<< "$video")")
- done
-
- subs=$(jq -s '.' <<< "${sub_array[@]}")
-
+ cd ..
+ source "${cfg[namespace]}/templates/header.shs"
+ render strings "${cfg[namespace]}/templates/themes/${cfg[template]}/watch_error.html"
+ return
+ fi
+ fi
fi
-
+ cd ..
+ strings[channel_id]=$(jq -r '.channel_url' <<< "$video" | sed -s 's/.*\/channel\///')
+ strings[uploader]=$(jq -r '.uploader' <<< "$video")
+ strings[title]=$(jq -r '.title' <<< "$video")
+ if [[ ${cfg[template]} != 'retro' ]]; then
+ meta[title]="${strings[title]}"
+ meta[description]="$(jq -r '.description' <<< "$video")"
+ meta[unsafe]="
+
+
+
+ "''
+ #source templates/head.sh
+ source "${cfg[namespace]}/templates/header.shs"
+ fi
+ formats=$(jq -c '[.formats[] | {"format_id":.format_id,"url":.url,"ext":.ext,"width":.width,"height":.height,"format_note":.format_note,"acodec":.acodec,"vcodec":.vcodec,"abr":.abr,"fps":.fps}]' <<< "$video")
+
+ sub_array=()
+
+ for i in $(jq -r '.subtitles | keys[]' <<< "$video"); do
+ sub_array+=("$(jq '.subtitles.'"$i"'[] | select(.ext == "vtt").url | {"url": ., "lang":"'"$i"'"}' <<< "$video")")
+ done
+
+ subs=$(jq -s '.' <<< "${sub_array[@]}")
+
if [[ "${r[host]}" == "${cfg[flash_host]}" ]]; then
IFS=$'\n'
urls=($(jq -r '.formats[] | select(.format_id == "22" or .format_id == "18").url' <<< "$video"))
@@ -169,8 +133,6 @@ if [[ "${get_data[v]}" ]]; then
vid="$(cat "temp/${written_id}_https_-_"*"watch"*".dump")"
vid_json="$(tr -d '\n' <<< "$vid" | grep -Poh "ytInitialData.*?" | sed 's/ytInitialData = //;s/<\/script>//')"
- #strings[recommended]=$()
-
_jq_to_array '.contents.twoColumnWatchNextResults.secondaryResults.secondaryResults.results[] | .compactAutoplayRenderer.contents[0].compactVideoRenderer, .compactVideoRenderer |
if .videoId != null then
[.videoId,