Compare commits
3 commits
3f79b9b48d
...
6b43d9ef5f
Author | SHA1 | Date | |
---|---|---|---|
6b43d9ef5f | |||
02eaae1023 | |||
c713490cc8 |
|
@ -2,6 +2,7 @@
|
||||||
#router "/uwu" "owo"
|
#router "/uwu" "owo"
|
||||||
|
|
||||||
|
|
||||||
|
router "/c/:c" "${cfg[namespace]}/webroot/channel.shs"
|
||||||
router "/channel/:id" "${cfg[namespace]}/webroot/channel.shs"
|
router "/channel/:id" "${cfg[namespace]}/webroot/channel.shs"
|
||||||
router "/user/:user" "${cfg[namespace]}/webroot/channel.shs"
|
router "/user/:user" "${cfg[namespace]}/webroot/channel.shs"
|
||||||
router "/playlist" "${cfg[namespace]}/webroot/playlist.shs"
|
router "/playlist" "${cfg[namespace]}/webroot/playlist.shs"
|
||||||
|
|
|
@ -3,13 +3,15 @@
|
||||||
declare -A strings
|
declare -A strings
|
||||||
|
|
||||||
if [[ "${params[id]}" ]]; then
|
if [[ "${params[id]}" ]]; then
|
||||||
data=$(haruhi-dl -J --flat-playlist "https://www.youtube.com/channel/${params[id]}")
|
data=$(haruhi-dl --ie-key YoutubeChannel -J --flat-playlist "https://www.youtube.com/channel/${params[id]}")
|
||||||
elif [[ "${params[user]}" ]]; then
|
elif [[ "${params[user]}" ]]; then
|
||||||
data=$(haruhi-dl -J --flat-playlist "https://www.youtube.com/user/${params[user]}")
|
data=$(haruhi-dl --ie-key YoutubeChannel -J --flat-playlist "https://www.youtube.com/user/${params[user]}")
|
||||||
|
elif [[ "${params[c]}" ]]; then
|
||||||
|
data=$(haruhi-dl --ie-key YoutubeChannel -J --flat-playlist "https://www.youtube.com/c/${params[c]}")
|
||||||
elif [[ "${get_data[id]}" ]]; then
|
elif [[ "${get_data[id]}" ]]; then
|
||||||
data=$(haruhi-dl -J --flat-playlist "https://www.youtube.com/channel/${get_data[id]}")
|
data=$(haruhi-dl --ie-key YoutubeChannel -J --flat-playlist "https://www.youtube.com/channel/${get_data[id]}")
|
||||||
elif [[ "${get_data[name]}" ]]; then
|
elif [[ "${get_data[name]}" ]]; then
|
||||||
data=$(haruhi-dl -J --flat-playlist "https://www.youtube.com/user/${get_data[name]}")
|
data=$(haruhi-dl --ie-key YoutubeChannel -J --flat-playlist "https://www.youtube.com/user/${get_data[name]}")
|
||||||
else
|
else
|
||||||
echo "Please specify either id or name"
|
echo "Please specify either id or name"
|
||||||
return
|
return
|
||||||
|
|
|
@ -13,7 +13,7 @@ if [[ "${get_data[q]}" ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${get_data[q]}" ]]; then
|
if [[ "${get_data[q]}" ]]; then
|
||||||
data=$(haruhi-dl "ytsearch30:${get_data[q]}" --flat-playlist -J | jq '.entries[]')
|
data=$(haruhi-dl --ie-key YoutubeSearch "ytsearch30:${get_data[q]}" --flat-playlist -J | jq '.entries[]')
|
||||||
|
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
id=($(jq -r '.id' <<< "$data"))
|
id=($(jq -r '.id' <<< "$data"))
|
||||||
|
@ -32,7 +32,7 @@ else
|
||||||
strings[results]="search for something will 'ya?"
|
strings[results]="search for something will 'ya?"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! $(which haruhi-dl) || $? != "0" ]]; then
|
if [[ ! "$(which haruhi-dl)" || $? != "0" ]]; then
|
||||||
strings[results]="Could not fetch search results"
|
strings[results]="Could not fetch search results"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ fi
|
||||||
|
|
||||||
declare -A strings
|
declare -A strings
|
||||||
|
|
||||||
if [[ ! $(which haruhi-dl) ]]; then
|
if [[ ! "$(which haruhi-dl)" ]]; then
|
||||||
strings[error]='Could not load video'
|
strings[error]='Could not load video'
|
||||||
source templates/head.sh
|
source templates/head.sh
|
||||||
source "${cfg[namespace]}/templates/header.shs"
|
source "${cfg[namespace]}/templates/header.shs"
|
||||||
|
@ -28,10 +28,10 @@ if [[ "${get_data[v]}" ]]; then
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
cd temp
|
cd temp
|
||||||
video=$(haruhi-dl --write-pages --cookies ${cfg[_cookies]} -J "http://youtube.com/watch?v=${get_data[v]}")
|
video=$(haruhi-dl --ie-key Youtube --write-pages --cookies "${cfg[_cookies]}" -J "http://youtube.com/watch?v=${get_data[v]}")
|
||||||
if [[ $video == '' ]]; then # okay who did this
|
if [[ $video == '' ]]; then # okay who did this
|
||||||
random_hash=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 24 | head -n 1)
|
random_hash=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 24 | head -n 1)
|
||||||
video=$(haruhi-dl --write-pages --cookies ${cfg[_cookies]} -J "http://youtube.com/watch?v=${get_data[v]}" &> output$random_hash.log)
|
video=$(haruhi-dl --ie-key Youtube --write-pages --cookies ${cfg[_cookies]} -J "http://youtube.com/watch?v=${get_data[v]}" &> output$random_hash.log)
|
||||||
if [[ $video == '' ]]; then # seriously WHO DID THIS
|
if [[ $video == '' ]]; then # seriously WHO DID THIS
|
||||||
output=$(cat output$random_hash.log)
|
output=$(cat output$random_hash.log)
|
||||||
rm output$random_hash.log
|
rm output$random_hash.log
|
||||||
|
@ -147,7 +147,7 @@ if [[ "${get_data[v]}" ]]; then
|
||||||
strings[playlist]=""
|
strings[playlist]=""
|
||||||
|
|
||||||
if [[ "${get_data[playlist]}" ]]; then
|
if [[ "${get_data[playlist]}" ]]; then
|
||||||
playlist=$(haruhi-dl --cookies ${cfg[_cookies]} -j --flat-playlist "https://www.youtube.com/playlist?list=${get_data[playlist]}")
|
playlist=$(haruhi-dl --ie-key YoutubePlaylist --cookies ${cfg[_cookies]} -j --flat-playlist "https://www.youtube.com/playlist?list=${get_data[playlist]}")
|
||||||
|
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
video_title=($(jq -r '.title' <<< $playlist))
|
video_title=($(jq -r '.title' <<< $playlist))
|
||||||
|
|
Loading…
Reference in a new issue