dotfiles

regexghost dotfiles and scripts
git clone https://git.regexghost.com/dotfiles.git
Log | Files | Refs | README

commit f480d55c1ba93474548e5e4629e98de87c7fbedc
parent 524b0fb0cbe6fb6886ec49a52b4812ebc96bb62e
Author: regexghost <dev@regexghost.com>
Date:   Sun, 21 Jun 2026 16:44:25 +0100

updated yt-data.sh to work with POSIX coreutils, plus check for newsraft being open in rss function, otherwise database file gets overwritten

Diffstat:
Mdotfiles/.kshrc | 1+
Mterminal-scripts/yt-data.sh | 9+++++----
2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/dotfiles/.kshrc b/dotfiles/.kshrc @@ -60,6 +60,7 @@ nnn () { } rss () { + pgrep newsraft > /dev/null && echo "Newsraft already open" && return command cp "$XDG_DATA_HOME/newsraft/newsraft.sqlite3" "/tmp/newsraft.sqlite3" newsraft -d "/tmp/newsraft.sqlite3" command mv "/tmp/newsraft.sqlite3" "$XDG_DATA_HOME/newsraft/newsraft.sqlite3" diff --git a/terminal-scripts/yt-data.sh b/terminal-scripts/yt-data.sh @@ -7,10 +7,11 @@ TEMP_FILE=/tmp/yt-data.html curl -s "$url" > "$TEMP_FILE" -title="$(cat "$TEMP_FILE" | sed -nE 's/.*videoDescriptionHeaderRenderer":\{"title":\{"runs":\[\{"text":"([^}]*)"\}.*/\1/p')" -channel="$(cat "$TEMP_FILE" | sed -nE 's/.*ownerProfileUrl[^@]*@([^"]*).*/\1/p' | head -n 1)" -description="$(cat "$TEMP_FILE" | sed -nE 's/.*videoDescriptionHeaderRenderer":\{"title":\{"runs":\[\{"text":"([^}]*).*/\1/p' | sed -nE 's/([^\]*)(\\n|").*/\1/p')".. -release_date="$(cat "$TEMP_FILE" | sed -nE 's/.*publishDate":\{"simpleText":"([^"]*)".*/\1/p')" +title="$(cat "$TEMP_FILE" | tr "}" "\n" | grep "videoDetails\":{\"videoId" | sed -nE 's/.*"title":"([^"]*).*/\1/p')" +channel="$(cat "$TEMP_FILE" | tr "}" "\n" | grep ownerProfileUrl | head -n 1 | sed -nE 's/.*https?:\/\/www.youtube.com\/[@]([^"]*).*/\1/p')" +description="$(cat "$TEMP_FILE" | tr "}" "\n" | grep "shortDescription" | head -n 1 | sed -nE 's/.*shortDescription":"([^"]*)".*/\1/p' | sed 's/\\u0026/\&/g')" +release_date="$(cat "$TEMP_FILE" | tr "}" "\n" | grep "publishDate\":{\"simpleText\"" | sed -nE 's/.*publishDate":\{"simpleText":"([^"]*).*/\1/p')" +[ "$description" = "" ] && description="$title" echo "$title" echo "$channel"