27 lines
956 B
Bash
27 lines
956 B
Bash
#!/bin/bash
|
|
title=$(curl -s "https://www.youtube.com/feeds/videos.xml?playlist_id=${get_data[list]}" | grep title | head -n 1 | sed -s 's/ <title>//;s/<\/title>//')
|
|
|
|
declare -A strings
|
|
|
|
if [[ ${cfg[template]} == 'default' ]]; then
|
|
meta[title]="$title"
|
|
source templates/head.sh
|
|
fi
|
|
|
|
if [[ "${get_data[list]}" ]]; then
|
|
data=$(haruhi-dl --cookies ${cfg[_cookies]} -j --flat-playlist "https://www.youtube.com/playlist?list=${get_data[list]}")
|
|
else
|
|
strings[playlist]="Please specify id"
|
|
fi
|
|
|
|
IFS=$'\n'
|
|
video_title=($(jq -r '.title' <<< $data))
|
|
video_id=($(jq -r '.id' <<< $data))
|
|
|
|
for (( i=0; i<${#video_id[@]}; i++ )); do
|
|
strings[playlist]+="<a href='watch?v=${video_id[$i]}&playlist=$(html_encode "${get_data[list]}")'><img src='https://i.ytimg.com/vi/${video_id[$i]}/mqdefault.jpg'><br>${video_title[$i]}</a><br>"
|
|
done
|
|
|
|
source "${cfg[namespace]}/templates/header.shs"
|
|
render_unsafe strings "${cfg[namespace]}/templates/themes/${cfg[template]}/playlist.t"
|