diff --git a/webroot/watch.shs b/webroot/watch.shs
index 533502b..82fbaad 100755
--- a/webroot/watch.shs
+++ b/webroot/watch.shs
@@ -4,25 +4,27 @@ if [[ "${get_data[v]}" ]]; then
if [[ "${get_data[v]}" == '18l' || "${get_data[v]}" == '5eFdt6Y_34E' ]]; then
uploader='MyMusicGroup'
title='█▬█ █ ▀█▀ Jeden Osiem L - Jak Zapomnieć (Oficjalny Teledysk)'
- url='http://sakamoto.pl/tmp/videoplayback_.webm'
+ url='https://sakamoto.pl/tmp/videoplayback_.webm'
meta[title]=$title
source templates/head.sh
else
- video=$(haruhi-dl $([[ ${cfg[_cookies]} != "" ]] && echo -n -- "-c ${cfg[_cookies]}") -J "http://youtube.com/watch?v=${get_data[v]}")
- if [[ $video == '' ]]; then
- video=$(haruhi-dl $([[ ${cfg[_cookies]} != "" ]] && echo -n -- "-c ${cfg[_cookies]}") -J "http://youtube.com/watch?v=${get_data[v]}")
- if [[ $video == '' ]]; then
+ cd temp
+ video=$(haruhi-dl --write-pages $([[ ${cfg[_cookies]} != "" ]] && echo -n -- "-c ${cfg[_cookies]}") -J "http://youtube.com/watch?v=${get_data[v]}")
+ if [[ $video == '' ]]; then # okay who did this
+ video=$(haruhi-dl --write-pages $([[ ${cfg[_cookies]} != "" ]] && echo -n -- "-c ${cfg[_cookies]}") -J "http://youtube.com/watch?v=${get_data[v]}")
+ if [[ $video == '' ]]; then # seriously WHO DID THIS
return
fi
fi
+ cd ..
#echo "http://youtube.com/watch?v=${get_data[v]}" > /dev/stderr
- channel_id=$(echo $video | jq -r '.channel_url' | sed -s 's/http:\/\/www.youtube.com\/channel\///')
- uploader=$(echo $video | jq -r '.uploader')
- title=$(echo $video | jq -r '.title')
- meta[title]=$title
+ channel_id=$(jq -r '.channel_url' <<< "$video" | sed -s 's/http:\/\/www.youtube.com\/channel\///')
+ uploader=$(jq -r '.uploader' <<< "$video")
+ title=$(jq -r '.title' <<< "$video")
+ meta[title]="$title"
source templates/head.sh
IFS=$'\n'
- urls=($(echo $video | jq -r '.formats[] | select(.format_id == "22" or .format_id == "18").url'))
+ urls=($(jq -r '.formats[] | select(.format_id == "22" or .format_id == "18").url' <<< "$video"))
unset IFS
if [[ ${urls[1]} != '' ]]; then
url=${urls[1]}
@@ -67,14 +69,19 @@ if [[ "${get_data[v]}" ]]; then
Description:
$(echo "$video" | jq -r '.description' | sed -E 's/$/
/g')
";
- vid="$(curl -s "https://www.youtube.com/watch?v=${get_data[v]}" -c cookiejar)"
+ vid="$(cat "temp/${get_data[v]}_https_-_"*"watch"*".dump" | tr -d '\n' | grep -Poh "ytInitialData.*?" | sed 's/ytInitialData = //;s/<\/script>//')"
+
- echo "