From d250b829cb023ada1b43176f9967bd5b156da6c0 Mon Sep 17 00:00:00 2001 From: Marcin Chrzanowski Date: Fri, 12 Dec 2025 13:25:33 +0100 Subject: Add youboat --- youboat | 32 ++++++++++++++++++++++++++++++++ yt-channel-id | 4 ++++ 2 files changed, 36 insertions(+) create mode 100755 youboat create mode 100755 yt-channel-id 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 diff --git a/yt-channel-id b/yt-channel-id new file mode 100755 index 0000000..a412974 --- /dev/null +++ b/yt-channel-id @@ -0,0 +1,4 @@ +#!/bin/bash + +URL=$1 +curl --silent $URL | grep -Po 'channel_id=.{24}' | head -n 1 | cut -d'=' -f 2 -- cgit v1.2.3