@@ -278,13 +278,21 @@ export default {
278278 url : bestUrl || _ . video . playAddr ,
279279 filename :
280280 i +
281+ 1 +
281282 "_" +
282- UfsGlobal . Utils . sanitizeName ( _ . desc . substr ( 0 , 50 ) ) +
283+ UfsGlobal . Utils . sanitizeName ( _ . id , false ) +
283284 ".mp4" ,
284285 } ;
285286 } ) ,
287+ ( i , total ) => {
288+ UfsGlobal . DOM . notify ( {
289+ msg : `Downloading... ${ i } /${ total } videos` ,
290+ duration : 30000 ,
291+ } ) ;
292+ } ,
286293 ( i , total ) => {
287294 downVideoBtn . textContent = `🎬 Download video (${ i } /${ total } )` ;
295+ UfsGlobal . DOM . notify ( { msg : `Downloaded ${ i } /${ total } videos` } ) ;
288296 }
289297 ) ;
290298 } ) ;
@@ -300,14 +308,23 @@ export default {
300308 url : _ . music . playUrl ,
301309 filename :
302310 i +
311+ 1 +
303312 "_" +
304313 UfsGlobal . Utils . sanitizeName (
305- _ . music . title . substr ( 0 , 50 ) || "audio"
314+ _ . music . title . substr ( 0 , 50 ) || "audio" ,
315+ false
306316 ) +
307317 ".mp3" ,
308318 } ) ) ,
319+ ( i , total ) => {
320+ UfsGlobal . DOM . notify ( {
321+ msg : `Downloading... ${ i } /${ total } audios` ,
322+ duration : 30000 ,
323+ } ) ;
324+ } ,
309325 ( i , total ) => {
310326 downAudioBtn . textContent = `🎧 Download audio (${ i } /${ total } )` ;
327+ UfsGlobal . DOM . notify ( { msg : `Downloaded ${ i } /${ total } audios` } ) ;
311328 }
312329 ) ;
313330 } ) ;
@@ -364,7 +381,7 @@ export default {
364381 ) ;
365382 break ;
366383 }
367- renderTable ( tbody , allVideoData ) ;
384+ renderTable ( tbody , getShowingVideos ( ) ) ;
368385 } ) ;
369386 }
370387 }
@@ -377,9 +394,7 @@ export default {
377394<td>${ v . index } </td>
378395<td>
379396 <a target="_blank" href="${ v . video . playAddr } ">
380- <object data="${ v . video . dynamicCover } " type="image/png" style="width:150px">
381- <img src="${ v . video . cover } " style="width:150px" />
382- </object>
397+ <img src="${ v . video . cover } " style="width:150px" />
383398 </a>
384399</td>
385400<td><p style="max-width:200px">${ v . desc } </p></td>
@@ -410,11 +425,18 @@ export default {
410425 . join ( "" ) ;
411426 }
412427
413- async function download ( expectBlobType , data , onProgress ) {
428+ async function download (
429+ expectBlobType ,
430+ data ,
431+ onProgressItem ,
432+ onFinishItem
433+ ) {
414434 const dir = await UfsGlobal . Utils . chooseFolderToDownload ( "tiktok" ) ;
435+ onProgressItem ?. ( 0 , data . length ) ;
415436
416437 for ( let i = 0 ; i < data . length ; ++ i ) {
417438 try {
439+ onProgressItem ?. ( i + 1 , data . length ) ;
418440 const { url, filename } = data [ i ] ;
419441 const realUrl = await UfsGlobal . Utils . getRedirectedUrl ( url ) ;
420442 await UfsGlobal . Utils . downloadToFolder ( {
@@ -423,7 +445,7 @@ export default {
423445 dirHandler : dir ,
424446 expectBlobType,
425447 } ) ;
426- onProgress ?. ( i + 1 , data . length ) ;
448+ onFinishItem ?. ( i + 1 , data . length ) ;
427449 } catch ( e ) {
428450 console . error ( e ) ;
429451 }
@@ -653,7 +675,7 @@ export default {
653675 // });
654676 links . push ( {
655677 url : link ,
656- name : sanitizeName ( cached ?. name || id ) + ".mp4" ,
678+ name : sanitizeName ( cached ?. name || id , false ) + ".mp4" ,
657679 } ) ;
658680 } else {
659681 progressDiv . innerText = `[LỖI] Không thể tải video ${ url } .` ;
0 commit comments