diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-08-15 16:40:43 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-08-15 16:40:43 +0200 |
commit | ece73a892806912ed45f875149065085690d64d4 (patch) | |
tree | c7e7acdf1d6ea9bbeeb19fd0c23bc4f16249e90d /bin | |
parent | 63c16da0da3e9b0cdc3fb6f9cd3031dc2297a09c (diff) |
[y2feed] added support for different links
You can now supply a channel id, a link to a channel or a tag, this
should work with yt-local and piped as well.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/common/y2feed | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/bin/common/y2feed b/bin/common/y2feed index e30bccf..b55d66b 100755 --- a/bin/common/y2feed +++ b/bin/common/y2feed @@ -1,5 +1,18 @@ #!/bin/sh -echo "url: $1" >&2 -curl -L -s "$1" | - pup 'link[title=RSS] attr{href}' | - tee /dev/stderr + +get_feed() +{ + link="$(curl -L -s "$1" | pup 'link[title=RSS] attr{href}' 2>/dev/null)" + [ "$link" ] && printf "%s\n" "$link" | tee /dev/stderr && exit +} + +[ "$1" ] || exit 1 + +# url is channel +get_feed "$1" + +part="$(echo "$1" | awk -F '/' '{print $NF}')" +# last part is channel id +get_feed "https://www.youtube.com/channel/$part" +# last part is channel tag +get_feed "https://www.youtube.com/$part" |