From 7410ddbfd1407d7a5a0758c5a9061a965e3da08d Mon Sep 17 00:00:00 2001 From: randomuser Date: Sun, 13 Nov 2022 18:21:06 +0000 Subject: [PATCH] update trss-yt-id to sfeed_yt_add --- Makefile | 2 +- sh/sfeed_yt_add | 25 +++++++++++++++++++++++++ sh/trss-yt-id | 8 -------- 3 files changed, 26 insertions(+), 9 deletions(-) create mode 100755 sh/sfeed_yt_add delete mode 100755 sh/trss-yt-id diff --git a/Makefile b/Makefile index 23a80de..458d811 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ man: sh: mkdir -p $(DESTDIR)$(PREFIX)/bin cp -f sh/paste $(DESTDIR)$(PREFIX)/bin - cp -f sh/trss-yt-id $(DESTDIR)$(PREFIX)/bin + cp -f sh/ $(DESTDIR)$(PREFIX)/bin cp -f sh/disp $(DESTDIR)$(PREFIX)/bin cp -f sh/wallpaper $(DESTDIR)$(PREFIX)/bin cp -f sh/connect $(DESTDIR)$(PREFIX)/bin diff --git a/sh/sfeed_yt_add b/sh/sfeed_yt_add new file mode 100755 index 0000000..43c8a95 --- /dev/null +++ b/sh/sfeed_yt_add @@ -0,0 +1,25 @@ +#!/bin/sh + +[ -z "$1" ] && exit 1 +[ -z "$2" ] && exit 1 + +printf "[info] this utility is used for adding youtube urls as rss feeds\n" + +feed="$(curl ${1} -s | \ + grep 'youtube/www\.youtube\.com/channel/.\{24\}' -o | \ + awk -F'/' '{print "https://www.youtube.com/feeds/videos.xml?channel_id=" $NF}' | \ + sed 1q)" + +[ -z "$feed" ] && printf "[err] error processing the feed. are you sure it's *www*.youtube.com and not youtube.com?\n" && exit 1 + +tmp="$(mktemp)" + +sfeedrc="$HOME/.config/sfeed/sfeedrc" + +ed "$sfeedrc" <