mirror of
https://github.com/movie-web/providers.git
synced 2025-09-13 13:33:25 +00:00
use thumnails from vidplay
This commit is contained in:
@@ -3,7 +3,7 @@ import { makeEmbed } from '@/providers/base';
|
|||||||
import { Caption, getCaptionTypeFromUrl, labelToLanguageCode } from '@/providers/captions';
|
import { Caption, getCaptionTypeFromUrl, labelToLanguageCode } from '@/providers/captions';
|
||||||
|
|
||||||
import { getFileUrl } from './common';
|
import { getFileUrl } from './common';
|
||||||
import { SubtitleResult, VidplaySourceResponse } from './types';
|
import { SubtitleResult, ThumbnailTrack, VidplaySourceResponse } from './types';
|
||||||
|
|
||||||
export const vidplayScraper = makeEmbed({
|
export const vidplayScraper = makeEmbed({
|
||||||
id: 'vidplay',
|
id: 'vidplay',
|
||||||
@@ -18,6 +18,15 @@ export const vidplayScraper = makeEmbed({
|
|||||||
});
|
});
|
||||||
if (typeof fileUrlRes.result === 'number') throw new Error('File not found');
|
if (typeof fileUrlRes.result === 'number') throw new Error('File not found');
|
||||||
const source = fileUrlRes.result.sources[0].file;
|
const source = fileUrlRes.result.sources[0].file;
|
||||||
|
const thumbnailSource = fileUrlRes.result.tracks.find((track) => track.kind === 'thumbnails');
|
||||||
|
|
||||||
|
let thumbnailTrack: ThumbnailTrack | undefined;
|
||||||
|
if (thumbnailSource) {
|
||||||
|
thumbnailTrack = {
|
||||||
|
type: 'vtt',
|
||||||
|
url: thumbnailSource.file,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
const url = new URL(ctx.url);
|
const url = new URL(ctx.url);
|
||||||
const subtitlesLink = url.searchParams.get('sub.info');
|
const subtitlesLink = url.searchParams.get('sub.info');
|
||||||
@@ -47,6 +56,7 @@ export const vidplayScraper = makeEmbed({
|
|||||||
playlist: source,
|
playlist: source,
|
||||||
flags: [flags.CORS_ALLOWED],
|
flags: [flags.CORS_ALLOWED],
|
||||||
captions,
|
captions,
|
||||||
|
thumbnailTrack,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
@@ -3,10 +3,10 @@ export type VidplaySourceResponse = {
|
|||||||
| {
|
| {
|
||||||
sources: {
|
sources: {
|
||||||
file: string;
|
file: string;
|
||||||
tracks: {
|
}[];
|
||||||
file: string;
|
tracks: {
|
||||||
kind: string;
|
file: string;
|
||||||
}[];
|
kind: string;
|
||||||
}[];
|
}[];
|
||||||
}
|
}
|
||||||
| number;
|
| number;
|
||||||
@@ -17,3 +17,8 @@ export type SubtitleResult = {
|
|||||||
label: string;
|
label: string;
|
||||||
kind: string;
|
kind: string;
|
||||||
}[];
|
}[];
|
||||||
|
|
||||||
|
export type ThumbnailTrack = {
|
||||||
|
type: 'vtt';
|
||||||
|
url: string;
|
||||||
|
};
|
||||||
|
Reference in New Issue
Block a user