2022-11-13 12:21:06 -06:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
[ -z "$1" ] && exit 1
|
|
|
|
[ -z "$2" ] && exit 1
|
|
|
|
|
|
|
|
printf "[info] this utility is used for adding youtube urls as rss feeds\n"
|
|
|
|
|
2022-11-27 11:04:53 -06:00
|
|
|
feed="$(curl "$1" -s | \
|
2022-11-13 12:21:06 -06:00
|
|
|
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
|
|
|
|
|
|
|
|
sfeedrc="$HOME/.config/sfeed/sfeedrc"
|
|
|
|
|
|
|
|
ed "$sfeedrc" <<EOF
|
|
|
|
/feeds
|
|
|
|
a
|
|
|
|
feed "$2" "$feed"
|
|
|
|
.
|
|
|
|
w
|
|
|
|
EOF
|