#!/bin/bash declare -A strings if [[ "${params[id]}" ]]; then data=$(haruhi-dl --ie-key YoutubeChannel -J --flat-playlist "https://www.youtube.com/channel/${params[id]}") elif [[ "${params[user]}" ]]; then 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 --ie-key YoutubeChannel -J --flat-playlist "https://www.youtube.com/channel/${get_data[id]}") elif [[ "${get_data[name]}" ]]; then 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 fi title=$(jq -r '.title' <<< $data) if [[ ${cfg[template]} == 'default' ]]; then meta[title]="$title" source templates/head.sh fi IFS=$'\n' video_title=($(jq -r '.entries[].title' <<< $data)) video_id=($(jq -r '.entries[].id' <<< $data)) #strings[subscribe]="

$title

Subscribe!
" strings[subscribe]='

'"$(html_encode "$title")'s channel"'

' echo uwu > /dev/stderr for (( i=0; i<${#video_id[@]}; i++ )); do strings[videos]+="
${video_title[$i]}

" done if [[ ! ${strings[videos]} ]]; then strings[videos]="Failed to fetch videos or channel does not have videos" fi source "${cfg[namespace]}/templates/header.shs" render_unsafe strings "${cfg[namespace]}/templates/themes/${cfg[template]}/channel.t"