commit a593f0e157cd8fa815ecd6966218c8e1aba0b976
parent e6bc84f26bc1345b99949a5fc469f63d25e00f93
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Sat, 19 Oct 2019 14:18:00 +0200
Merge branch 'master' of src.adamsgaard.dk:src/dotfiles
Diffstat:
2 files changed, 30 insertions(+), 19 deletions(-)
diff --git a/.config/rss2email.cfg b/.config/rss2email.cfg
@@ -471,3 +471,12 @@ url = https://www.youtube.com/feeds/videos.xml?channel_id=UCY2mhw-XNZSxrUynsI5K8
[feed.youtube_Numberphile]
url = https://www.youtube.com/feeds/videos.xml?channel_id=UCoxcjq-8xIDTYp3uz647V5A
+[feed.youtube_Nokia_Bell_Labs]
+url = https://www.youtube.com/feeds/videos.xml?channel_id=UCJIjs5B0HQtbuH48uibfLqQ
+
+[feed.youtube_Kamerastore]
+url = https://www.youtube.com/feeds/videos.xml?channel_id=
+
+[feed.youtube_Kameratori]
+url = https://www.youtube.com/feeds/videos.xml?channel_id=UC8ZmIB3UVOpunylWLJb7zTQ
+
diff --git a/.local/bin/youtube-channel-id b/.local/bin/youtube-channel-id
@@ -1,12 +1,10 @@
#!/usr/bin/env bash
-nbcfg=$HOME/.config/newsboat/urls
-
function help {
- echo "Usage: ${0##*/} [add] <youtube-url>"
- echo "or: ${0##*/} [add] <youtube-channel-name>"
- echo "if the optional command 'add' is used, the channel is added to the "
- echo "newsboat feed list in $nbcfg"
+ echo "Usage: ${0##*/} [add] <youtube-url>"
+ echo "or: ${0##*/} [add] <youtube-channel-name>"
+ echo "if the optional command 'add' is used, the channel is added to the "
+ echo "r2e feed list"
}
[ $# -lt 1 ] && help && exit 1
@@ -18,24 +16,28 @@ function help {
# detect if url or just channel name
if ! [[ "$url" =~ ^(http:\/\/|https:\/\/).*$ ]]; then
- url="https://www.youtube.com/user/$url"
+ url="https://www.youtube.com/user/$url"
fi
id="$(curl --silent "$url" | \
- grep 'data-channel-external-id' | \
- sed 's/.*data-channel-external-id="//' | \
- sed 's/".*//' | \
- sed '1q')"
+ grep 'data-channel-external-id' | \
+ sed 's/.*data-channel-external-id="//' | \
+ sed 's/".*//' | \
+ sed '1q')"
name="$(echo "$url" | sed 's/.*\///' )"
-if [ "$1" = "add" ]; then
- mkdir -p "$(dirname "$nbcfg")"
- echo -n "https://www.youtube.com/feeds/videos.xml?channel_id=${id} " \
- >> "$nbcfg"
- echo "youtube \"~youtube: $name\"" >> "$nbcfg"
+if [ ! -n "$id" ]; then
+ echo "channel $name not found"
+ exit 1
+fi
- echo "$name ($id) added"
+if [ "$1" = "add" ]; then
+ r2e add "youtube_${name}" \
+ "https://www.youtube.com/feeds/videos.xml?channel_id=${id}"
+ echo "$name ($id) added"
else
- echo "$id"
- echo "$id" | xclip
+ echo "$id"
+ if type xclip >/dev/null 2>&1; then
+ echo "$id" | xclip
+ fi
fi