commit
b0df27f41b
|
@ -2,6 +2,10 @@
|
|||
title: 'Changelog'
|
||||
---
|
||||
|
||||
# Version 2.0.1
|
||||
- Fixed issue where febbox-mp4 would not show all qualities
|
||||
- Fixed issue where discoverEmbeds event would not show the embeds in the right order
|
||||
|
||||
# Version 2.0.0
|
||||
|
||||
::alert{type="warning"}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@movie-web/providers",
|
||||
"version": "2.0.0",
|
||||
"version": "2.0.1",
|
||||
"description": "Package that contains all the providers of movie-web",
|
||||
"main": "./lib/index.umd.js",
|
||||
"types": "./lib/index.d.ts",
|
||||
|
|
|
@ -4,24 +4,35 @@ import { ScrapeContext } from '@/utils/context';
|
|||
|
||||
const allowedQualities = ['360', '480', '720', '1080', '4k'];
|
||||
|
||||
export async function getStreamQualities(ctx: ScrapeContext, apiQuery: object) {
|
||||
const mediaRes: { list: { path: string; quality: string; fid?: number }[] } = (await sendRequest(ctx, apiQuery)).data;
|
||||
interface FebboxQuality {
|
||||
path: string;
|
||||
real_quality: string;
|
||||
fid?: number;
|
||||
}
|
||||
|
||||
const qualityMap = mediaRes.list
|
||||
.filter((file) => allowedQualities.includes(file.quality.replace('p', '')))
|
||||
.map((file) => ({
|
||||
url: file.path,
|
||||
quality: file.quality.replace('p', ''),
|
||||
}));
|
||||
function mapToQuality(quality: FebboxQuality): FebboxQuality | null {
|
||||
const q = quality.real_quality.replace('p', '').toLowerCase();
|
||||
if (!allowedQualities.includes(q)) return null;
|
||||
return {
|
||||
real_quality: q,
|
||||
path: quality.path,
|
||||
fid: quality.fid,
|
||||
};
|
||||
}
|
||||
|
||||
export async function getStreamQualities(ctx: ScrapeContext, apiQuery: object) {
|
||||
const mediaRes: { list: FebboxQuality[] } = (await sendRequest(ctx, apiQuery)).data;
|
||||
|
||||
const qualityMap = mediaRes.list.map((v) => mapToQuality(v)).filter((v): v is FebboxQuality => !!v);
|
||||
|
||||
const qualities: Record<string, StreamFile> = {};
|
||||
|
||||
allowedQualities.forEach((quality) => {
|
||||
const foundQuality = qualityMap.find((q) => q.quality === quality);
|
||||
if (foundQuality && foundQuality.url) {
|
||||
const foundQuality = qualityMap.find((q) => q.real_quality === quality && q.path);
|
||||
if (foundQuality) {
|
||||
qualities[quality] = {
|
||||
type: 'mp4',
|
||||
url: foundQuality.url,
|
||||
url: foundQuality.path,
|
||||
};
|
||||
}
|
||||
});
|
||||
|
|
|
@ -116,9 +116,12 @@ export async function runAllProviders(list: ProviderList, ops: ProviderRunnerOpt
|
|||
};
|
||||
}
|
||||
|
||||
if (output.embeds.length > 0) {
|
||||
// run embed scrapers on listed embeds
|
||||
const sortedEmbeds = output.embeds.sort((a, b) => embedIds.indexOf(a.embedId) - embedIds.indexOf(b.embedId));
|
||||
|
||||
if (sortedEmbeds.length > 0) {
|
||||
ops.events?.discoverEmbeds?.({
|
||||
embeds: output.embeds.map((v, i) => ({
|
||||
embeds: sortedEmbeds.map((v, i) => ({
|
||||
id: [s.id, i].join('-'),
|
||||
embedScraperId: v.embedId,
|
||||
})),
|
||||
|
@ -126,10 +129,6 @@ export async function runAllProviders(list: ProviderList, ops: ProviderRunnerOpt
|
|||
});
|
||||
}
|
||||
|
||||
// run embed scrapers on listed embeds
|
||||
const sortedEmbeds = output.embeds;
|
||||
sortedEmbeds.sort((a, b) => embedIds.indexOf(a.embedId) - embedIds.indexOf(b.embedId));
|
||||
|
||||
for (const ind in sortedEmbeds) {
|
||||
if (!Object.prototype.hasOwnProperty.call(sortedEmbeds, ind)) continue;
|
||||
const e = sortedEmbeds[ind];
|
||||
|
|
Loading…
Reference in New Issue