MCPcopy Create free account
hub / github.com/Useful-Scripts-Extension/useful-script / downloadAudio

Function downloadAudio

scripts/douyin_batchDownload.js:343–370  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

341 alert("Downloaded " + success + "/" + total + " videos!");
342 },
343 async downloadAudio() {
344 const total = this.audioToDownload.length;
345 if (!total) return;
346 let success = 0;
347 await download({
348 folderName: "douyin_musics_" + getNow(),
349 data: this.audioToDownload.map((_, i) => ({
350 url: _.music.playUrl,
351 filename:
352 i +
353 1 +
354 "_" +
355 UfsGlobal.Utils.sanitizeName(
356 _.music.title.substr(0, 50) || "audio",
357 false
358 ) +
359 ".mp3",
360 })),
361 onProgressItem: (i, total) => {
362 this.downloading.audio = i;
363 },
364 onFinishItem: (i, total) => {
365 success++;
366 },
367 });
368 this.downloading.audio = false;
369 alert("Downloaded " + success + "/" + total + " videos!");
370 },
371 downloadJson() {
372 UfsGlobal.Utils.downloadData(
373 JSON.stringify(this.videosToShow, null, 4),

Callers

nothing calls this directly

Calls 2

downloadFunction · 0.70
getNowFunction · 0.70

Tested by

no test coverage detected