mirror of
https://github.com/movie-web/movie-web.git
synced 2024-12-28 01:41:50 +01:00
refactor(streamsb): improve quality sorting
This commit is contained in:
parent
7e948c60c1
commit
a0bb03790a
@ -100,7 +100,7 @@ registerEmbedScraper({
|
|||||||
"[onclick^=download_video]"
|
"[onclick^=download_video]"
|
||||||
);
|
);
|
||||||
|
|
||||||
const dlDetails = [];
|
let dlDetails = [];
|
||||||
for (const func of downloadVideoFunctions) {
|
for (const func of downloadVideoFunctions) {
|
||||||
const funcContents = func.getAttribute("onclick");
|
const funcContents = func.getAttribute("onclick");
|
||||||
const regExpFunc = /download_video\('(.+?)','(.+?)','(.+?)'\)/;
|
const regExpFunc = /download_video\('(.+?)','(.+?)','(.+?)'\)/;
|
||||||
@ -121,6 +121,12 @@ registerEmbedScraper({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dlDetails = dlDetails.sort((a, b) => {
|
||||||
|
const aQuality = qualityOrder.indexOf(a.quality.label as MWStreamQuality);
|
||||||
|
const bQuality = qualityOrder.indexOf(b.quality.label as MWStreamQuality);
|
||||||
|
return aQuality - bQuality;
|
||||||
|
});
|
||||||
|
|
||||||
progress(40);
|
progress(40);
|
||||||
|
|
||||||
let dls = await Promise.all(
|
let dls = await Promise.all(
|
||||||
@ -187,11 +193,6 @@ registerEmbedScraper({
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
dls = dls.filter((d) => !!d.url);
|
dls = dls.filter((d) => !!d.url);
|
||||||
dls = dls.sort((a, b) => {
|
|
||||||
const aQuality = qualityOrder.indexOf(a.quality);
|
|
||||||
const bQuality = qualityOrder.indexOf(b.quality);
|
|
||||||
return aQuality - bQuality;
|
|
||||||
});
|
|
||||||
|
|
||||||
progress(60);
|
progress(60);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user