🍿 @lorenzopant/tmdb

All

Get trending movies, TV shows, and people on TMDB for a given time window.

Get the trending movies, TV shows and people on TMDB in a single call. Results are a discriminated union on media_type — each item is either "movie", "tv", or "person".

async all(params: TrendingParams): Promise<PaginatedResponse<TrendingAllResult>>

TMDB Reference: Trending All

Parameters

NameTypeRequiredDescription
time_windowTrendingTimeWindowTime window for trending data. "day" covers the last 24 hours, "week" covers the last 7 days.
languageLanguageLanguage for localized results. Defaults to en-US.

Returns

A PaginatedResponse<TrendingAllResult> containing an array of TrendingAllResult objects — a discriminated union on media_type.

Example

import { TMDB } from "@lorenzopant/tmdb";

const tmdb = new TMDB("your-api-key");
const { results } = await tmdb.trending.all({ time_window: "day" });

for (const item of results) {
	if (item.media_type === "movie") {
		console.log(item.title); // "Fight Club"
	} else if (item.media_type === "tv") {
		console.log(item.name); // "The Mandalorian"
	} else {
		console.log(item.name); // "Ana de Armas"
	}
}

On this page