YouTube is kind of a pain in the ass these days

This commit is contained in:
Nox Sluijtman 2024-04-03 15:43:39 +02:00
parent 999ca55f97
commit ababcae988

18
invyt.nu Executable file
View file

@ -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)
}