Created
July 16, 2023 10:26
-
-
Save HarHarLinks/aed649a4063dc1428e7fe0bc3a986cb2 to your computer and use it in GitHub Desktop.
run like `./get-youtube-channel-feed-url.sh https://www.youtube.com/channel/UCuAXFkgsw1L7xaCfnd5JJOw` which will return `https://www.youtube.com/feeds/videos.xml?channel_id=UCuAXFkgsw1L7xaCfnd5JJOw` which is an atom feed of the channel's videos
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
if [[ ! -z "$1" ]]; | |
then | |
channelid=$(curl --silent "$1" | grep "externalId" | sed -E 's/.+"externalId":"([[:alnum:]]+)".+/\1/') | |
if [[ ! -z "$channelid" ]]; | |
then | |
echo -n "https://www.youtube.com/feeds/videos.xml?channel_id=$channelid" | |
echo "" | |
exit 0 | |
fi | |
fi | |
echo "provide YouTube channel URL as argument" | |
exit 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment