Tüm kaynaklar
TMDb Trending
Eğlence v1.0.0Trending movies and TV shows from The Movie Database
@codytseng #movies #tv #trending #entertainment
Yapılandırma
| Ad | Anahtar | Tür | Zorunlu | Varsayılan | Açıklama |
|---|---|---|---|---|---|
| API Key | TMDB_API_KEY | secret | Evet | — | Free API key from themoviedb.org |
| Media Type | MEDIA_TYPE | select | Hayır | all | Type of media to show allmovietv |
| Time Window | TIME_WINDOW | select | Hayır | week | Trending time window dayweek |
Kaynak Kodu
version: 1.0.0
name: TMDb Trending
description: Trending movies and TV shows from The Movie Database
author: codytseng
author_url: https://github.com/codytseng
category: Entertainment
tags:
- movies
- tv
- trending
- entertainment
config:
- key: TMDB_API_KEY
name: API Key
type: secret
required: true
description: "Free API key from themoviedb.org"
- key: MEDIA_TYPE
name: Media Type
type: select
required: false
default: all
description: Type of media to show
options:
- all
- movie
- tv
- key: TIME_WINDOW
name: Time Window
type: select
required: false
default: week
description: Trending time window
options:
- day
- week version: 1.0.0
name: TMDb Trending
description: Trending movies and TV shows from The Movie Database
author: codytseng
author_url: https://github.com/codytseng
category: Entertainment
tags:
- movies
- tv
- trending
- entertainment
config:
- key: TMDB_API_KEY
name: API Key
type: secret
required: true
description: "Free API key from themoviedb.org"
- key: MEDIA_TYPE
name: Media Type
type: select
required: false
default: all
description: Type of media to show
options:
- all
- movie
- tv
- key: TIME_WINDOW
name: Time Window
type: select
required: false
default: week
description: Trending time window
options:
- day
- week import type { GlancewayAPI, SourceMethods } from "../../types";
export default (api: GlancewayAPI): SourceMethods => {
const apiKey = api.config.get("TMDB_API_KEY");
const mediaType = api.config.get("MEDIA_TYPE") || "all";
const timeWindow = api.config.get("TIME_WINDOW") || "week";
return {
async refresh() {
const url = `https://api.themoviedb.org/3/trending/${mediaType}/${timeWindow}?api_key=${apiKey}`;
const response = await api.fetch<{
results: {
id: number;
title?: string;
name?: string;
overview: string;
media_type: string;
release_date?: string;
first_air_date?: string;
}[];
}>(url);
if (response.ok && response.json) {
const items = response.json.results.map((item) => ({
id: String(item.id),
title: item.title ?? item.name ?? "Unknown",
subtitle: item.overview,
url: `https://www.themoviedb.org/${item.media_type}/${item.id}`,
timestamp: item.release_date ?? item.first_air_date,
}));
api.emit(items);
}
},
};
}; import type { GlancewayAPI, SourceMethods } from "../../types";
export default (api: GlancewayAPI): SourceMethods => {
const apiKey = api.config.get("TMDB_API_KEY");
const mediaType = api.config.get("MEDIA_TYPE") || "all";
const timeWindow = api.config.get("TIME_WINDOW") || "week";
return {
async refresh() {
const url = `https://api.themoviedb.org/3/trending/${mediaType}/${timeWindow}?api_key=${apiKey}`;
const response = await api.fetch<{
results: {
id: number;
title?: string;
name?: string;
overview: string;
media_type: string;
release_date?: string;
first_air_date?: string;
}[];
}>(url);
if (response.ok && response.json) {
const items = response.json.results.map((item) => ({
id: String(item.id),
title: item.title ?? item.name ?? "Unknown",
subtitle: item.overview,
url: `https://www.themoviedb.org/${item.media_type}/${item.id}`,
timestamp: item.release_date ?? item.first_air_date,
}));
api.emit(items);
}
},
};
};