#!/bin/bash
title=$(curl https://www.youtube.com/feeds/videos.xml?channel_id=${get_data[id]} | grep title | head -n 1 | sed -s 's/
//;s/<\/title>//')
meta[title]=$title
source templates/head.sh
if [[ ${get_data[id]} ]]; then
data=$(haruhi-dl -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]})
else
echo "Please specify either id or name"
return
fi
IFS=$'\n'
video_title=($(jq -r '.title' <<< $data))
video_id=($(jq -r '.id' <<< $data))
echo "$title
Subscribe!
"
for (( i=0; i<${#video_id[@]}; i++ )); do
echo "
${video_title[$i]}
"
done