Merge pull request #97 from lem6ns/dev

Fix TV if quality is lower than 1080p or 720p
This commit is contained in:
James Hawkins 2022-12-06 13:22:36 +00:00 committed by GitHub
commit 33d62f5547
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -174,10 +174,12 @@ export const superStreamScraper: MWMediaProvider = {
}; };
const mediaRes = (await get(apiQuery).then((r) => r.json())).data; const mediaRes = (await get(apiQuery).then((r) => r.json())).data;
const hdQuality = const hdQuality =
mediaRes.list.find((quality: any) => quality.quality === "1080p") ?? mediaRes.list.find((quality: any) => (quality.quality === "1080p" && quality.path)) ??
mediaRes.list.find((quality: any) => quality.quality === "720p") ?? mediaRes.list.find((quality: any) => (quality.quality === "720p" && quality.path)) ??
mediaRes.list.find((quality: any) => quality.quality === "480p") ?? mediaRes.list.find((quality: any) => (quality.quality === "480p" && quality.path)) ??
mediaRes.list.find((quality: any) => quality.quality === "360p"); mediaRes.list.find((quality: any) => (quality.quality === "360p" && quality.path));
if (!hdQuality) throw new Error("No quality could be found.");
const subtitleApiQuery = { const subtitleApiQuery = {
fid: hdQuality.fid, fid: hdQuality.fid,
@ -215,8 +217,12 @@ export const superStreamScraper: MWMediaProvider = {
}; };
const mediaRes = (await get(apiQuery).then((r) => r.json())).data; const mediaRes = (await get(apiQuery).then((r) => r.json())).data;
const hdQuality = const hdQuality =
mediaRes.list.find((quality: any) => quality.quality === "1080p") ?? mediaRes.list.find((quality: any) => (quality.quality === "1080p" && quality.path)) ??
mediaRes.list.find((quality: any) => quality.quality === "720p"); mediaRes.list.find((quality: any) => (quality.quality === "720p" && quality.path)) ??
mediaRes.list.find((quality: any) => (quality.quality === "480p" && quality.path)) ??
mediaRes.list.find((quality: any) => (quality.quality === "360p" && quality.path));
if (!hdQuality) throw new Error("No quality could be found.");
const subtitleApiQuery = { const subtitleApiQuery = {
fid: hdQuality.fid, fid: hdQuality.fid,