1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-06 03:50:04 +02:00
This commit is contained in:
Daniel Neto 2023-02-27 14:22:49 -03:00
parent fea0280f1e
commit c6a075e56d

View file

@ -2390,12 +2390,14 @@ function goToURLOrAlertError(jsonURL, data) {
}
function downloadURL(url, filename) {
modal.showPleaseWait();
filename = clean_name(filename) + '.' + clean_name(url.split(/[#?]/)[0].split('.').pop().trim());
console.log('downloadURL start ', url, filename);
var loaded = 0;
var contentLength = 0;
fetch(url)
.then(response => {
modal.hidePleaseWait();
avideoToastSuccess('Download Start');
const contentEncoding = response.headers.get('content-encoding');
const contentLength = response.headers.get(contentEncoding ? 'x-file-size' : 'content-length');