#!/bin/bash
if session_verify ${cookies[sh_session]} && [[ ${get_data[id]} != '' ]]; then
title=$(curl https://www.youtube.com/feeds/videos.xml?channel_id=${get_data[id]} | grep title | head -n 1 | sed -s 's/
//;s/<\/title>//')
if [[ $(cat storage/subscribed | grep -F "$title" | grep "$(echo ${cookies[username]} | sed -E "s/\r//")") == '' ]]; then
echo "$(session_get_username ${cookies[sh_session]}):${get_data[id]}:$title" >> storage/subscribed
fi
fi
source templates/head.sh
echo "<--- back to main
Channels you subscribe to
"
IFS=$'\n'
for i in $(tac storage/subscribed); do
IFS=':'
array=($i)
if [[ ${array[1]} == '' ]]; then
break
fi
echo "";
done