update trss-yt-id to sfeed_yt_add

This commit is contained in:
randomuser 2022-11-13 18:21:06 +00:00
parent a4cdc434be
commit 7410ddbfd1
3 changed files with 26 additions and 9 deletions

View File

@ -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

25
sh/sfeed_yt_add Executable file
View File

@ -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" <<EOF
/feeds
a
feed "$2" "$feed"
.
w
EOF

View File

@ -1,8 +0,0 @@
#!/bin/sh
[ -z "$1" ] && exit 1
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