diff --git a/deno-src/lib.ts b/deno-src/lib.ts index 2816960..c9c2838 100644 --- a/deno-src/lib.ts +++ b/deno-src/lib.ts @@ -125,7 +125,9 @@ export class YouTubeDownloader implements API { const videoStream = ytdl(url, { format: videoFormat }); const audioStream = ytdl(url, { format: audioFormat }); - + videoStream.once("readable", () => { + startCallback?.(); + }); videoStream.on("progress", (_, downloaded, total) => { videoDownloaded += downloaded; const now = Date.now(); diff --git a/jsr.json b/jsr.json index 6e03517..709e8b5 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@kunkun/kunkun-ext-youtube-downloader", - "version": "0.1.1", + "version": "0.1.2", "license": "MIT", "exports": "./mod.ts", "imports": { diff --git a/package.json b/package.json index 0603fa1..bf44f08 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.kunkun.sh", "name": "kunkun-ext-youtube-dowloader", - "version": "0.1.1", + "version": "0.1.2", "license": "MIT", "type": "module", "kunkun": { diff --git a/src/index.ts b/src/index.ts index eb36809..576e09e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -180,7 +180,7 @@ class DownloadYouTubeExtension extends WorkerExtension { } let url = await clipboard.readText(); - // url = "https://youtu.be/-b1FogYHTZc"; // for development only + url = "https://youtu.be/-b1FogYHTZc"; // for development only // check if url is a valid youtube url if (!url.includes("youtube.com") && !url.includes("youtu.be")) { toast.warning("Invalid YouTube URL from clipboard"); @@ -189,8 +189,10 @@ class DownloadYouTubeExtension extends WorkerExtension { const formats = await this.rpc.api.getAvailableResolutions(url); const form = new Form.Form({ title: "Download YouTube Video", - description: "Please copy a YouTube URL then enter this extension.", - key: "form1", + description: `Please copy a YouTube URL then enter this extension. + High Resolution video (e.g. 4K) could take a very long time to download, please be patient. + A progress bar with estimated time isn't implemented yet. There is a loading bar on the top.`, + key: "download-youtube-video", showFormDataDebug: true, submitBtnText: "Download", fields: [