From d6e4c4e9ad72d71cf01f835e03ffed100d69fccd Mon Sep 17 00:00:00 2001 From: btkoch Date: Fri, 24 Nov 2023 23:27:18 -0500 Subject: added README --- README.md | 1 + yt-feed | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100755 yt-feed diff --git a/README.md b/README.md index 72ec60d..804b3ec 100644 --- a/README.md +++ b/README.md @@ -1 +1,2 @@ # yt-feed +Simple bash script that takes a YouTube channel name as input and outputs either the RSS feed URL or, with the `-i` option, the channel ID. diff --git a/yt-feed b/yt-feed new file mode 100755 index 0000000..98b19e2 --- /dev/null +++ b/yt-feed @@ -0,0 +1,13 @@ +#!/bin/bash +if [ -z "$1" ]; then + echo "Usage: $0 [-i] " + exit +elif [[ $1 != -i ]]; then + url=$(curl -s "https://validator.w3.org/feed/check.cgi?url=https://youtube.com/@$1" | grep "Validator Results" | sed -n 's/.*Results: \(.*\)<\/title>.*/\1/p') + echo $url +else [ $1 == -i ]; + url=$(curl -s "https://validator.w3.org/feed/check.cgi?url=https://youtube.com/@$2" | grep "Validator Results" | sed -n 's/.*id=\(.*\)<\/title>.*/\1/p') + echo $url +fi + + -- cgit v1.2.3