aboutsummaryrefslogtreecommitdiff
path: root/scripts/ytdlp_download.ts
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-05-20 23:37:23 +0200
committermetamuffin <metamuffin@disroot.org>2025-05-20 23:37:23 +0200
commitbe7e08a3b891a28479af77dcf1d0e016fd9ff35f (patch)
treefbe0689cd6907baf4293981f245019b9d0654c92 /scripts/ytdlp_download.ts
parent3af24e140aa6053381b6746bca6a370934503e73 (diff)
downloadisda-be7e08a3b891a28479af77dcf1d0e016fd9ff35f.tar
isda-be7e08a3b891a28479af77dcf1d0e016fd9ff35f.tar.bz2
isda-be7e08a3b891a28479af77dcf1d0e016fd9ff35f.tar.zst
bilibili support
Diffstat (limited to 'scripts/ytdlp_download.ts')
-rw-r--r--scripts/ytdlp_download.ts9
1 files changed, 7 insertions, 2 deletions
diff --git a/scripts/ytdlp_download.ts b/scripts/ytdlp_download.ts
index 9489e49..184f2f5 100644
--- a/scripts/ytdlp_download.ts
+++ b/scripts/ytdlp_download.ts
@@ -24,9 +24,14 @@ export class TextLineStream extends TransformStream<string, string> {
}
}
+const supported = [
+ "youtube",
+ "bilibili",
+]
function key_to_url(key: string): string {
const [kind, id] = key.split(":", 2)
- if (kind == "youtube") return `https://youtube.com/watch?v=${id}`
+ if (kind == "youtube") return `https://www.youtube.com/watch?v=${id}`
+ if (kind == "bilibili") return `https://www.bilibili.com/video/${id}`
throw new Error("unknown kind");
}
@@ -79,7 +84,7 @@ ws.onclose = () => {
}
ws.onopen = () => {
console.log("ws open");
- ws.send(JSON.stringify({ t: "register", name: "yt-dlp video downloader", task_kinds: ["youtube"] }))
+ ws.send(JSON.stringify({ t: "register", name: "yt-dlp video downloader", task_kinds: supported }))
ws.send(JSON.stringify({ t: "accept" }))
}
ws.onmessage = async ev => {