aboutsummaryrefslogtreecommitdiff
path: root/lynx-youtube-handler
diff options
context:
space:
mode:
authorPhilip Wittamore <philip@wittamore.com>2025-10-18 17:01:10 +0200
committerPhilip Wittamore <philip@wittamore.com>2025-10-18 17:01:10 +0200
commit681133565ce3c417bec8c06e44dda1812f6a257e (patch)
tree856d89b0650f919490a1f5f1f84c645b4b552e2b /lynx-youtube-handler
parentc6a7d51df19e6dc06f2a120c07619980b865d0ce (diff)
downloadscripts-master.tar.gz
scripts-master.tar.bz2
scripts-master.zip
Diffstat (limited to 'lynx-youtube-handler')
-rwxr-xr-xlynx-youtube-handler13
1 files changed, 13 insertions, 0 deletions
diff --git a/lynx-youtube-handler b/lynx-youtube-handler
new file mode 100755
index 0000000..da71719
--- /dev/null
+++ b/lynx-youtube-handler
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+# open youtube link in mpv
+
+URL=https:$(awk -F'https%3a' '{print $2}' <<< "$1")
+
+if curl --head --silent $URL > /dev/null 2>&1; then
+ echo "Opening Youtube video $URL" >> $HOME/.lynx-log
+ notify-send "Launching mpv $URL"
+ mpv $URL >/dev/null 2>&1 &
+else
+ echo "Youtube video: invalid URL $URL" >> $HOME/.lynx-log
+ notify-send "invalid URL $URL"
+fi