mirror of
https://github.com/movie-web/providers.git
synced 2025-09-13 09:23:26 +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 { getFileUrl } from './common';
|
||||
import { SubtitleResult, VidplaySourceResponse } from './types';
|
||||
import { SubtitleResult, ThumbnailTrack, VidplaySourceResponse } from './types';
|
||||
|
||||
export const vidplayScraper = makeEmbed({
|
||||
id: 'vidplay',
|
||||
@@ -18,6 +18,15 @@ export const vidplayScraper = makeEmbed({
|
||||
});
|
||||
if (typeof fileUrlRes.result === 'number') throw new Error('File not found');
|
||||
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 subtitlesLink = url.searchParams.get('sub.info');
|
||||
@@ -47,6 +56,7 @@ export const vidplayScraper = makeEmbed({
|
||||
playlist: source,
|
||||
flags: [flags.CORS_ALLOWED],
|
||||
captions,
|
||||
thumbnailTrack,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
@@ -3,10 +3,10 @@ export type VidplaySourceResponse = {
|
||||
| {
|
||||
sources: {
|
||||
file: string;
|
||||
tracks: {
|
||||
file: string;
|
||||
kind: string;
|
||||
}[];
|
||||
}[];
|
||||
tracks: {
|
||||
file: string;
|
||||
kind: string;
|
||||
}[];
|
||||
}
|
||||
| number;
|
||||
@@ -17,3 +17,8 @@ export type SubtitleResult = {
|
||||
label: string;
|
||||
kind: string;
|
||||
}[];
|
||||
|
||||
export type ThumbnailTrack = {
|
||||
type: 'vtt';
|
||||
url: string;
|
||||
};
|
||||
|
Reference in New Issue
Block a user