aboutsummaryrefslogtreecommitdiff
path: root/scripts/ytdlp_channel_info.ts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/ytdlp_channel_info.ts')
-rw-r--r--scripts/ytdlp_channel_info.ts10
1 files changed, 7 insertions, 3 deletions
diff --git a/scripts/ytdlp_channel_info.ts b/scripts/ytdlp_channel_info.ts
index c02182c..803336c 100644
--- a/scripts/ytdlp_channel_info.ts
+++ b/scripts/ytdlp_channel_info.ts
@@ -4,10 +4,13 @@ const ws = new WebSocket(Deno.args[0])
// deno-lint-ignore no-unused-vars
let config: Config = {} as unknown as Config
+const supported = [
+ "youtube-channel-info"
+]
function key_to_url(key: string): string {
const [kind, id] = key.split(":", 2)
- if (kind == "youtube-channel") return `https://youtube.com/channel/${id}`
- throw new Error("unknown kind");
+ if (kind == "youtube-channel-info") return `https://youtube.com/channel/${id}`
+ throw new Error(`unknown kind ${kind}`);
}
async function dfile(path: string, url: string) {
@@ -52,7 +55,7 @@ ws.onclose = () => {
}
ws.onopen = () => {
console.log("ws open");
- ws.send(JSON.stringify({ t: "register", name: "yt-dlp channel info generator", task_kinds: ["youtube-channel-info"] }))
+ ws.send(JSON.stringify({ t: "register", name: "yt-dlp channel info generator", task_kinds: supported }))
ws.send(JSON.stringify({ t: "accept" }))
}
ws.onmessage = async ev => {
@@ -63,6 +66,7 @@ ws.onmessage = async ev => {
if (p.t == "work") {
const url = key_to_url(p.key)
if (!p.data.output) throw new Error("no output");
+ console.log(`got work ${p.key}`);
await save_infojson(url, p.key, p.data)
ws.send(JSON.stringify({ t: "complete", key: p.key }))
ws.send(JSON.stringify({ t: "save" }))