#!/bin/bash declare -A strings 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 [[ $((grep -PF ":$title$" | grep "$(echo ${cookies[username]} | sed -E "s/\r//")") <<< storage/subscribed) == '' ]]; then echo "$(session_get_username ${cookies[sh_session]}):${get_data[id]}:$title" >> storage/subscribed fi fi if [[ ${cfg[template]} == 'default' ]]; then source templates/head.sh fi nested_declare channels declare -A channels_ IFS=$'\n' for i in $(tac storage/subscribed | grep -P "^$(session_get_username ${cookies[sh_session]}):"); do IFS=':' array=($i) if [[ ${array[1]} == '' ]]; then break fi channels_[id]="${array[1]}" channels_[name]="${array[@]:2:9999}" nested_add channels channels_ done [[ ${channels_[id]} != '' ]] && strings[?sub]=true strings[_sub]="channels" unset IFS if [[ ! ${strings[subscribe]} ]]; then strings[subscribe]="You are not logged in or you do not have any subscribed channels" fi source "${cfg[namespace]}/templates/header.shs" render strings "${cfg[namespace]}/templates/themes/${cfg[template]}/subscribe.html"