m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/youboat
diff options
context:
space:
mode:
authorMarcin Chrzanowski <m@m-chrzan.xyz>2025-12-12 13:25:33 +0100
committerMarcin Chrzanowski <m@m-chrzan.xyz>2025-12-12 13:25:33 +0100
commitd250b829cb023ada1b43176f9967bd5b156da6c0 (patch)
tree9b07bad6e831febe29db9feb356e76797a93d1fe /youboat
parentc3586a8cda0db26057288dfe9a1e75d710efbb3c (diff)
Add youboatHEADmaster
Diffstat (limited to 'youboat')
-rwxr-xr-xyouboat32
1 files changed, 32 insertions, 0 deletions
diff --git a/youboat b/youboat
new file mode 100755
index 0000000..bf1e102
--- /dev/null
+++ b/youboat
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+URLS_FILE=~/.config/newsboat/youtube-urls
+
+if [[ "$1" == "sub" ]]; then
+ if [[ -n "$2" ]]; then
+ link="$2"
+ else
+ echo 'Provide channel link:'
+ read link
+ fi
+
+ html_file=`mktemp`
+ curl --silent $link > $html_file
+ channel_id=`yt-channel-id $link`
+ channel_name=`pup --file $html_file 'meta[property="og:title"]' attr{content}`
+ rm $html_file
+
+ if [[ -z "$channel_id" ]]; then
+ echo "Failed to parse channel ID"
+ exit 1
+ fi
+
+ feed_url="https://www.youtube.com/feeds/videos.xml?channel_id=$channel_id"
+
+
+ echo "$feed_url video \"~$channel_name\"" >> "$URLS_FILE"
+ echo "Added channel: $channel_name"
+ exit 0
+fi
+
+newsboat -u "$URLS_FILE" -c ~/.local/share/newsboat/youtube-cache.db