From c713490cc82cf996c760bc6b4c9d72b1abaca6c6 Mon Sep 17 00:00:00 2001 From: Dominika Liberda Date: Tue, 30 Mar 2021 23:22:16 +0200 Subject: [PATCH] + makes use of new haruhi-dl infoextractor picker (thanks, @selfisekai! :3) --- webroot/channel.shs | 10 ++++++---- webroot/search.shs | 4 ++-- webroot/watch.shs | 6 +++--- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/webroot/channel.shs b/webroot/channel.shs index aac1569..425648a 100644 --- a/webroot/channel.shs +++ b/webroot/channel.shs @@ -3,13 +3,15 @@ declare -A strings 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 - 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 - 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 - 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 echo "Please specify either id or name" return diff --git a/webroot/search.shs b/webroot/search.shs index d6e2619..58a28e9 100755 --- a/webroot/search.shs +++ b/webroot/search.shs @@ -13,7 +13,7 @@ if [[ "${get_data[q]}" ]]; then fi 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' id=($(jq -r '.id' <<< "$data")) @@ -32,7 +32,7 @@ else strings[results]="search for something will 'ya?" fi -if [[ ! $(which haruhi-dl) || $? != "0" ]]; then +if [[ ! "$(which haruhi-dl)" || $? != "0" ]]; then strings[results]="Could not fetch search results" fi diff --git a/webroot/watch.shs b/webroot/watch.shs index a9a7f13..27f4496 100755 --- a/webroot/watch.shs +++ b/webroot/watch.shs @@ -28,10 +28,10 @@ if [[ "${get_data[v]}" ]]; then fi else 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 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 output=$(cat output$random_hash.log) rm output$random_hash.log @@ -147,7 +147,7 @@ if [[ "${get_data[v]}" ]]; then strings[playlist]="" 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' video_title=($(jq -r '.title' <<< $playlist))