From ababcae98823d313038af188ae881ef8e133e2ca Mon Sep 17 00:00:00 2001 From: Marty Sluijtman Date: Wed, 3 Apr 2024 15:43:39 +0200 Subject: [PATCH] YouTube is kind of a pain in the ass these days --- invyt.nu | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 invyt.nu diff --git a/invyt.nu b/invyt.nu new file mode 100755 index 0000000..1a093a6 --- /dev/null +++ b/invyt.nu @@ -0,0 +1,18 @@ +#!/usr/bin/env nu + +def get_url [url: string] { + let parsed_url = $url | url parse + if ($parsed_url.path | str contains '/watch') { + if $parsed_url.host != "youtube.com" { + $url | str replace $parsed_url.host "youtube.com" + } else { + $url + } + } else { + "Not a YouTube/Invidious/Piped URL" + } +} + +def main [--url: string] { + yt-dlp --embed-chapters --embed-metadata --embed-subs (get_url $url) +}