mirror of
https://github.com/sct/overseerr.git
synced 2025-09-17 17:24:35 +02:00
feat: YouTube Movie/TV Trailers (#454)
* feat: Get Youtube trailers from TMDB API and show on Movie/TV details page * docs(overseerr-api.yml): remove youtube trailer URL (unused) from OAS
This commit is contained in:
@@ -2,8 +2,12 @@ import {
|
||||
TmdbCreditCast,
|
||||
TmdbCreditCrew,
|
||||
TmdbExternalIds,
|
||||
TmdbVideo,
|
||||
TmdbVideoResult,
|
||||
} from '../api/themoviedb';
|
||||
|
||||
import { Video } from '../models/Movie';
|
||||
|
||||
export interface ProductionCompany {
|
||||
id: number;
|
||||
logoPath?: string;
|
||||
@@ -84,3 +88,18 @@ export const mapExternalIds = (eids: TmdbExternalIds): ExternalIds => ({
|
||||
tvrageId: eids.tvrage_id,
|
||||
twitterId: eids.twitter_id,
|
||||
});
|
||||
|
||||
export const mapVideos = (videoResult: TmdbVideoResult): Video[] =>
|
||||
videoResult?.results.map(({ key, name, size, type, site }: TmdbVideo) => ({
|
||||
site,
|
||||
key,
|
||||
name,
|
||||
size,
|
||||
type,
|
||||
url: siteUrlCreator(site, key),
|
||||
}));
|
||||
|
||||
const siteUrlCreator = (site: Video['site'], key: string): string =>
|
||||
({
|
||||
YouTube: `https://www.youtube.com/watch?v=${key}/`,
|
||||
}[site]);
|
||||
|
Reference in New Issue
Block a user