Updating the Youtube RSS Feed Extraction Script
In a previous blog post, I wrote a script to extract RSS feed URLs from
Youtube channel URLs.
It seems Youtube has recently updated the URL schema for named channels,
channels may now start with a @
symbol and in this case don’t have the
/c/
path in the URL anymore.
An example for such a URL is https://www.youtube.com/@Geschichtsfenster
.
Luckily, the page content has not changed, so we can easily update the script.
We just need to check two variants for $channel_with_name
.
Maybe this would not even be needed. Possibly all channel URLs were
changed, but in case of Google/Youtube I would keep all my options available.
Instead of the following URL check:
channel_with_name=$(echo $url | grep 'youtube.com/c/[0-9a-zA-Z_-][0-9a-zA-Z_-]*' --only-matching)
We just use the following:
regexp='youtube.com/(c/|@)[0-9a-zA-Z_-][0-9a-zA-Z_-]*'
channel_with_name=$(echo $url | grep -E "$regexp" --only-matching)
And we’re ready to go:
$ ./youtube-channel-rss.sh https://www.youtube.com/@Geschichtsfenster
https://www.youtube.com/feeds/videos.xml?channel_id=UCaPghPJUFIHrClDy03FpB0A
$ ./youtube-channel-rss.sh https://www.youtube.com/c/Geschichtsfenster
https://www.youtube.com/feeds/videos.xml?channel_id=UCaPghPJUFIHrClDy03FpB0A