+ makes use of new haruhi-dl infoextractor picker (thanks, @selfisekai! :3)

merge-requests/5/head
Dominika Liberda 2021-03-30 23:22:16 +02:00
parent 3f79b9b48d
commit c713490cc8
3 changed files with 11 additions and 9 deletions

View File

@ -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

View File

@ -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

View File

@ -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))