19 lines
401 B
Plaintext
19 lines
401 B
Plaintext
|
#!/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)
|
||
|
}
|