summaryrefslogtreecommitdiff
path: root/util/yt-suffix
diff options
context:
space:
mode:
Diffstat (limited to 'util/yt-suffix')
-rwxr-xr-xutil/yt-suffix12
1 files changed, 12 insertions, 0 deletions
diff --git a/util/yt-suffix b/util/yt-suffix
new file mode 100755
index 0000000..fc9ccb4
--- /dev/null
+++ b/util/yt-suffix
@@ -0,0 +1,12 @@
+#!/bin/sh
+# Get the suffix from a Youtube video, or Invidious instance.
+# https://youtube.com/watch?v=dQw4w9WgXcQ -> dQw4w9WgXcQ
+# Pass the -w flag if you want to keep the watch?v=
+# Usage:
+# yt-suffix PATH (-w)
+
+if isflag '-w' "$@" ; then
+ echo "watch?v="
+fi
+
+echo $1 | awk -F'/' '{print $4}' | awk -F'=' '{print $2}'