Glanceway Glanceway
सभी सोर्स

TMDb Trending

मनोरंजन v1.0.0

Trending movies and TV shows from The Movie Database

@codytseng #movies #tv #trending #entertainment

Install and configure this source

  1. Install Glanceway and open it on your Mac before using the install link above.
  2. Choose Install in Glanceway. If the browser cannot open the app, download the .gwsrc file and import it through source management.
  3. Complete the required fields below, save, and choose a refresh interval. Check the source after its first successful fetch.

Configuration checklist

  • TMDB_API_KEY — Required. Free API key from themoviedb.org Use your own credential; do not share it in screenshots or public files.
  • MEDIA_TYPE — Optional. Type of media to show
  • TIME_WINDOW — Optional. Trending time window

If items are missing

  • Verify the field names, list entries, and credentials against the current version’s configuration table. Sample values below are examples, not active credentials.
  • Check network access and upstream service availability. Authentication failures and rate limits can prevent a refresh; use a slower interval when the provider limits requests.
  • An empty result can also mean there are no matching items. Fetched content and update timing depend on the provider and source implementation.

कॉन्फ़िगरेशन

नाम कुंजी प्रकार आवश्यक डिफ़ॉल्ट विवरण
API Key TMDB_API_KEY secret हाँ — Free API key from themoviedb.org
Media Type MEDIA_TYPE select नहीं all Type of media to show
allmovietv
Time Window TIME_WINDOW select नहीं week Trending time window
dayweek

सोर्स कोड

id: codytseng/tmdb-trending
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
module.exports = async (api) => {
  const apiKey = api.config.get("TMDB_API_KEY");
  const mediaType = api.config.get("MEDIA_TYPE") || "all";
  const timeWindow = api.config.get("TIME_WINDOW") || "week";

  async function fetchData() {
    const url = `https://api.themoviedb.org/3/trending/${mediaType}/${timeWindow}?api_key=${apiKey}`;

    const response = await api.fetch(url);

    if (!response.ok || !response.json) {
      throw new Error(`Failed to fetch TMDB trending (HTTP ${response.status})`);
    }

    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);
  }

  await fetchData();

  return {
    refresh: fetchData,
  };
};

संबंधित स्रोत