2 ms·
I had this quite shity function to give me the feed URL of a channel when I give it the URL of a video: idyoutube () { if [[ "$1" = *\=* ]]; then
by zouhair 10y ago
I had this quite shity function to give me the feed URL of a channel when I give it the URL of a video:
idyoutube ()
{
if [[ "$1" = *\=* ]]; then
vidid=$(echo "$1" | cut -d "&" -f 1 | cut -d "=" -f 2);
else
vidid=$(echo "$1" | cut -d "/" -f 4);
fi;
id=$(curl -s "https://www.youtube.com/watch?v=${vidid}" | tac | \grep "data-channel-external-id=" -m 1 | tr " " "\n" | \grep "data-channel-external-id" -m 1 | cut -d '"' -f 2)
echo -en "https://www.youtube.com/feeds/videos.xml?channel_id=${id}\n"
}