2020-02-08 23:43:37 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2021-03-30 01:39:55 +00:00
|
|
|
if echo "$1" | grep "https*://\S\+\.[A-Za-z]\+\S*" >/dev/null; then
|
|
|
|
url="$1"
|
|
|
|
else
|
|
|
|
url="$(grep -Eom1 '<[^>]+(rel="self"|application/[a-z]+\+xml)[^>]+>' "$1" |
|
|
|
|
sed -E 's_^.*href="(https?://[^"]+)".*$_\1_')"
|
|
|
|
|
|
|
|
! grep "https*://\S\+\.[A-Za-z]\+\S*" <<<"$url" &&
|
|
|
|
notify-send "That doesn't look like a full URL." && exit 1
|
|
|
|
fi
|
|
|
|
|
2020-04-08 23:10:00 +00:00
|
|
|
RSSFILE="${XDG_CONFIG_HOME:-$HOME/.config}/newsboat/urls"
|
2021-03-30 01:39:55 +00:00
|
|
|
if awk '{print $1}' "$RSSFILE" | grep "^$url$" >/dev/null; then
|
2019-03-20 18:45:08 +00:00
|
|
|
notify-send "You already have this RSS feed."
|
2019-03-13 01:20:17 +00:00
|
|
|
else
|
2021-03-30 01:39:55 +00:00
|
|
|
echo "$url" >> "$RSSFILE" && notify-send "RSS feed added."
|
2019-03-13 01:20:17 +00:00
|
|
|
fi
|