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

Function downloadVideo

scripts/douyin_batchDownload.js:312–342  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

310 },
311 methods: {
312 async downloadVideo() {
313 const total = this.videoToDownload.length;
314 if (!total) return;
315 let success = 0;
316 await download({
317 folderName: "douyin_videos_" + getNow(),
318 expectBlobTypes: ["video/mp4"],
319 data: this.videoToDownload
320 .map((_, i) => {
321 return {
322 url: _.video.play_addr.url_list.at(-1),
323 filename:
324 i +
325 1 +
326 "_" +
327 UfsGlobal.Utils.sanitizeName(_.aweme_id, false) +
328 ".mp4",
329 };
330 })
331 .flat()
332 .filter((_) => _.url),
333 onProgressItem: (i, total) => {
334 this.downloading.video = i;
335 },
336 onFinishItem: (i, total) => {
337 success++;
338 },
339 });
340 this.downloading.video = false;
341 alert("Downloaded " + success + "/" + total + " videos!");
342 },
343 async downloadAudio() {
344 const total = this.audioToDownload.length;
345 if (!total) return;

Callers

nothing calls this directly

Calls 3

filterMethod · 0.80
downloadFunction · 0.70
getNowFunction · 0.70

Tested by

no test coverage detected