Glanceway Glanceway
所有信息源

TMDb Trending

娱乐 v1.0.0

Trending movies and TV shows from The Movie Database

@codytseng #movies #tv #trending #entertainment

安装与配置方法

  1. 先在 Mac 上安装并打开 Glanceway,再使用上方的安装链接。
  2. 点击“安装到 Glanceway”。如果浏览器无法唤起应用,下载 .gwsrc 文件并在信息源管理中导入。
  3. 填写下列必填字段并保存,设置刷新间隔,等待首次成功获取。

配置检查

  • TMDB_API_KEY — 必填. Free API key from themoviedb.org 填写自己的访问凭据,不要在截图或公开文件中分享。
  • MEDIA_TYPE — 可选. Type of media to show
  • TIME_WINDOW — 可选. Trending time window

没有显示内容时如何排查

  • 对照当前版本配置表核对字段、列表项和凭据。下方示例不包含可用的真实凭据。
  • 检查网络与上游服务状态。认证失败或速率限制可能导致刷新失败,应根据上游限制调整间隔。
  • 空列表也可能表示没有符合条件的条目。内容和更新时间取决于数据提供方及信息源实现。

配置项

名称 键 类型 必填 默认值 描述
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,
  };
};

相关信息源