commit d05b1e01a60d629014cc48650ebd554d796f9b3c parent 322ebd8080a09e6918c9136020fb56be37a40530 Author: Anders Damsgaard <anders@adamsgaard.dk> Date: Fri, 25 Jan 2019 17:00:17 +0100 Add functionality to add channel to newsboat feeds Diffstat:
M | links/bin/youtube-channel-id.sh | | | 16 | ++++++++++++---- |
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/links/bin/youtube-channel-id.sh b/links/bin/youtube-channel-id.sh @@ -4,13 +4,21 @@ function help { echo "Usage: ${0##*/} <youtube-url>" } -[ $# -ne 1 ] && help && exit 1 +[ $# -lt 1 ] && help && exit 1 -id="$(curl --silent "$1" | \ +[ $# -eq 1 ] && url="$1" +[ $# -eq 2 ] && url="$2" + +id="$(curl --silent "$url" | \ grep 'data-channel-external-id' | \ sed 's/.*data-channel-external-id="//' | \ sed 's/".*//' | \ sed '1q')" -echo "$id" -echo "$id" | xclip +if [ "$1" = "add" ]; then + echo "https://www.youtube.com/feeds/videos.xml?channel_id=${id} \"YouTube Subscriptions\"" >> ~/.config/newsboat/urls + echo "$id added" +else + echo "$id" + echo "$id" | xclip +fi