TMDB 剧集 API:按 ID 获取电视剧详情

TMDB 剧集 API 用 GET /3/tv/{series_id} 按 ID 返回一部剧:名称、状态、季、电视网,以及上一集和下一集。JSON 与 TMDB v3 相同,只需换基础 URL。一次请求最多合并 20 项子资源,含分级和评分。

更新于 以 Markdown 查看

怎么按 ID 获取电视剧详情?

发送 GET /3/tv/{series_id} 并带上密钥。以《绝命毒师》(1396)为例,响应列出 5 季、62 集和 AMC 电视网,只占你每分钟 20、40 或 120 个请求中的一个。要从片名找到 ID,先调用 TMDB 搜索 API。全部接口见 API 参考。

这个调用返回一部剧的核心记录:名称、简介、状态、类型、电视网、季列表,以及指向上一集和下一集的信息。ID 是数字形式的 TMDB 剧集 ID,所以你已经存为 1396 的剧在这里仍是这个 ID。电影 ID 和剧集 ID 是两个独立的空间,因此请始终把媒体类型和数字一起保存。

下面的示例以英语请求《绝命毒师》,并在同一次调用中追加它的分级和外部评分。

bashjspyphpgo
curl -sSf "https://api.amodb.dev/3/tv/1396?language=en-US&append_to_response=content_ratings,ratings" \
  -H "Authorization: Bearer $AMODB_KEY"
const params = new URLSearchParams({ language: 'en-US', append_to_response: 'content_ratings,ratings' });
const res = await fetch(`https://api.amodb.dev/3/tv/1396?${params}`, {
  headers: { Authorization: `Bearer ${process.env.AMODB_KEY}` },
});
if (!res.ok) throw new Error(`amodb returned ${res.status}`);
const show = await res.json();
const us = show.content_ratings.results.find((r) => r.iso_3166_1 === 'US');
console.log(show.name, show.status, show.number_of_seasons, us?.rating);
import os
import requests

r = requests.get(
    "https://api.amodb.dev/3/tv/1396",
    params={"language": "en-US", "append_to_response": "content_ratings,ratings"},
    headers={"Authorization": f"Bearer {os.environ['AMODB_KEY']}"},
    timeout=10,
)
r.raise_for_status()
show = r.json()
us = next((x for x in show["content_ratings"]["results"] if x["iso_3166_1"] == "US"), None)
print(show["name"], show["status"], show["number_of_seasons"], us and us["rating"])
<?php
$url = 'https://api.amodb.dev/3/tv/1396?' . http_build_query([
    'language' => 'en-US',
    'append_to_response' => 'content_ratings,ratings',
]);
$ch = curl_init($url);
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT => 10,
    CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('AMODB_KEY')],
]);
$body = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($status !== 200) {
    throw new RuntimeException("amodb returned $status");
}
$show = json_decode($body, true);
echo $show['name'], ' ', $show['status'], ' ', $show['number_of_seasons'], PHP_EOL;
package main

import (
	"encoding/json"
	"fmt"
	"net/http"
	"net/url"
	"os"
	"time"
)

type Show struct {
	Name             string `json:"name"`
	Status           string `json:"status"`
	NumberOfSeasons  int    `json:"number_of_seasons"`
	NumberOfEpisodes int    `json:"number_of_episodes"`
	Next             *struct {
		AirDate string `json:"air_date"`
	} `json:"next_episode_to_air"`
}

func main() {
	q := url.Values{"language": {"en-US"}}
	req, _ := http.NewRequest("GET", "https://api.amodb.dev/3/tv/1396?"+q.Encode(), nil)
	req.Header.Set("Authorization", "Bearer "+os.Getenv("AMODB_KEY"))
	client := &http.Client{Timeout: 10 * time.Second}
	res, err := client.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()
	if res.StatusCode != http.StatusOK {
		panic(res.Status)
	}
	var s Show
	if err := json.NewDecoder(res.Body).Decode(&s); err != nil {
		panic(err)
	}
	next := "none scheduled"
	if s.Next != nil {
		next = s.Next.AirDate
	}
	fmt.Println(s.Name, s.Status, s.NumberOfSeasons, s.NumberOfEpisodes, next)
}

参数

  • series_id路径必填
    数字形式的剧集 ID,例如 1396。
  • api_key查询二选一
    你的密钥。使用它,或使用 Authorization: Bearer 请求头。
  • language查询
    en-US、uk-UA 或 es-ES 这样的 TMDB 标签。提供 14 种基础语言。默认 en-US。
  • append_to_response查询
    用逗号分隔的子资源列表,合并进响应,最多 20 个值。

响应字段

字段类型说明
idinteger剧集 ID。
name、original_namestring本地化标题和原始标题。日语或韩语的原始名称保留在 original_name 中。
overview、taglinestring本地化文本,没有译文时为空。
first_air_date、last_air_datestring 或 nullYYYY-MM-DD。
statusstring生命周期,见下表。
in_productionboolean剧集仍在制作时为 true。
number_of_seasons、number_of_episodesinteger总数,按该剧存储的数值。
episode_run_timearray常见的单集时长,单位分钟,可能为空。
seasonsarray每季一份摘要,含 id、season_number、name、overview、episode_count、air_date、poster_path、vote_average。
last_episode_to_air、next_episode_to_airobject 或 null单集摘要,结构与季与集中的对象相同。
networks、production_companiesarrayid、name、logo_path、origin_country。
production_countries、spoken_languagesarray国家含 iso_3166_1 和 name。语言含 english_name、iso_639_1 和 name。
created_byarray主创人员,含 id、name、profile_path 和 credit_id。大多数剧集为空。
genresarray带有 id 和 name 的对象。剧集的类型 ID 与电影的不同。
origin_country、original_language、languagesarray、string国家代码和语言代码。
homepagestring官方网站,未知时为空。
poster_path、backdrop_pathstring 或 null拼接到 https://img.amodb.dev/t/p/{size}。见图片。
popularitynumber热门列表使用的相对分数。
vote_average、vote_countnumber、integer用户评分汇总。
adultboolean始终为 false。成人作品永远不会提供。

示例响应

GET /3/tv/1396?language=en-US&append_to_response=content_ratings,ratings,较长的数组和文本已缩短:

JSON
{
  "adult": false,
  "backdrop_path": "/ycFcYYnzVc8mWw41neszGPMyKc3.jpg",
  "created_by": [],
  "episode_run_time": [
    48,
    49
  ],
  "first_air_date": "2008-01-20",
  "genres": [
    {
      "id": 18,
      "name": "Drama"
    },
    {
      "id": 80,
      "name": "Crime"
    }
  ],
  "homepage": "",
  "id": 1396,
  "in_production": false,
  "languages": [
    "en"
  ],
  "last_air_date": "2013-09-29",
  "last_episode_to_air": {
    "air_date": "2013-09-29",
    "episode_number": 16,
    "episode_type": "standard",
    "id": 62161,
    "name": "פלינה",
    "overview": "הסדרה זוכת הפרסים מגיעה לסיום דרמתי בפרק החותם אותה.",
    "production_code": "",
    "runtime": 56,
    "season_number": 5,
    "show_id": 1396,
    "still_path": "/pA0YwyhvdDXP3BEGL2grrIhq8aM.jpg",
    "vote_average": 0,
    "vote_count": 0
  },
  "name": "Breaking Bad",
  "next_episode_to_air": null,
  "networks": [
    {
      "id": 174,
      "logo_path": "/pmvRmATOCaDykE6JrVoeYxlFHw3.png",
      "name": "AMC",
      "origin_country": "US"
    }
  ],
  "number_of_episodes": 62,
  "number_of_seasons": 5,
  "origin_country": [
    "US"
  ],
  "original_language": "en",
  "original_name": "Breaking Bad",
  "overview": "Walter White, a New Mexico chemistry teacher, is diagnosed with Stage III cancer and given a prognosis of o...",
  "popularity": 268.4968,
  "poster_path": "/anFx9aTOOYqgS3v7x3R84Kz67ly.jpg",
  "production_companies": [
    {
      "id": 2605,
      "logo_path": null,
      "name": "Gran Via Productions",
      "origin_country": "US"
    },
    {
      "id": 11073,
      "logo_path": "/wHs44fktdoj6c378ZbSWfzKsM2Z.png",
      "name": "Sony Pictures Television",
      "origin_country": "US"
    }
  ],
  "production_countries": [
    {
      "iso_3166_1": "US",
      "name": "United States of America"
    }
  ],
  "seasons": [
    {
      "air_date": "2009-02-17",
      "episode_count": 9,
      "id": 3577,
      "name": "特别篇",
      "overview": "",
      "poster_path": "/ikBSCmgG5Z4jequUUAjKpf1QG3T.jpg",
      "season_number": 0,
      "vote_average": 0
    },
    {
      "air_date": "2008-01-20",
      "episode_count": 7,
      "id": 3572,
      "name": "Season 1",
      "overview": "High school chemistry teacher Walter White's life is suddenly transformed by a dire medical diagnosis. Stre...",
      "poster_path": "/91EIXdWxmp2mHNRsSuDW3WyDJLj.jpg",
      "season_number": 1,
      "vote_average": 0
    }
  ],
  "spoken_languages": [
    {
      "english_name": "English",
      "iso_639_1": "en",
      "name": "English"
    },
    {
      "english_name": "Spanish",
      "iso_639_1": "es",
      "name": "Español"
    }
  ],
  "status": "Ended",
  "tagline": "Change the equation.",
  "vote_average": 9,
  "vote_count": 18863,
  "content_ratings": {
    "results": [
      {
        "descriptors": [],
        "iso_3166_1": "AT",
        "rating": "16"
      },
      {
        "descriptors": [],
        "iso_3166_1": "AU",
        "rating": "MA 15+"
      }
    ]
  },
  "ratings": {
    "imdb": {
      "value": 9.5,
      "votes": 2671962
    },
    "kinopoisk": {
      "value": 8.9,
      "votes": null
    },
    "metacritic": null,
    "rotten_tomatoes": {
      "value": 96,
      "votes": null
    },
    "tmdb": {
      "value": 9,
      "votes": 18863
    }
  }
}

content_ratings 和 ratings 数据块来自 append_to_response。seasons、last_episode_to_air 和 next_episode_to_air 里的名称和简介是按记录存储的,可能不遵循 language,上面的希伯来语集名就是例子。要读取本地化的季和集文本,请用季接口。

怎么知道一部电视剧是否还在播出?

status 告诉你这部剧处于生命周期的哪个阶段,next_episode_to_air 告诉你何时再来查看。

status 取值含义next_episode_to_air
Returning Series正在播出,或处于两季之间。已知日期时有值,否则为 null。
Planned、In Production还不是正式连载的剧集。通常为 null。
Ended已播完。为 null。
Canceled在计划的结局之前停播。为 null。

处于两季之间的连载剧,next_episode_to_air 为 null,所以应把 null 理解为“暂时没有已知日期”,而不是“已经完结”。

seasons 数组每季列出一份摘要,第 0 季是特别篇。要读取某一季的各集,请调用季与集 API上的接口,它列出一季的所有集。想一并了解剧集、季和单集,见电视剧 API页面,要查播出日期,见剧集单集 API。

还有哪些相关的剧集接口?

所有路径共用基础地址 https://api.amodb.dev/3,带本地化文本的接口也接受 language。

方法和路径返回内容额外参数
GET /tv/{series_id}/alternative_titles含 iso_3166_1、title、type 的 {id, results},通常为空无
GET /tv/{series_id}/content_ratings各国的年龄分级无
GET /tv/{series_id}/episode_groups其他集数排序方式的列表,例如 DVD 或剧情线无
GET /tv/{series_id}/recommendations20 部推荐剧集的列表无
GET /tv/{series_id}/similar20 部相似剧集的列表无
GET /tv/{series_id}/reviews大多数剧集的 results 为空无
GET /tv/{series_id}/lists包含该剧的公开列表page
GET /tv/{series_id}/watch/providers各国的流媒体、租赁和购买平台无
GET /tv/latest最新添加的剧集记录无

推荐和相似列表始终返回第 1 页的 20 项。lists 响应用 page 分页,每页 20 个列表。API 其他位置的分页列表,page 取 1 到 500。

分级以 results 条目返回,含 iso_3166_1、rating 和 descriptors,请选出与观众所在国家匹配的条目。观看平台按国家代码分组,每个国家有一个 link,以及带 provider_id、provider_name、logo_path 和 display_priority 的 flatrate、rent 和 buy 列表。用于筛选的平台 ID 来自 TMDB 类型 ID页面上的查找列表。

剧集分组列表返回 id(字符串)、name、description、type、episode_count、group_count 和 network。amodb 会列出这些分组,但不提供返回某一分组所含各集的接口。它也不提供 TMDB 的 changes 路径。

append_to_response 对剧集怎么用?

把子资源列在 append_to_response 中,每一个都会出现在各自的键下。整个调用只占你每分钟 20、40 或 120 个请求中的一个。最多可用 20 个值,未知名称会被忽略,不报错。下面这些值可用于剧集:

取值增加详情
credits演员和剧组演职员 API
external_idsimdb_id、tvdb_id 和 wikidata_id 等 ID按 IMDb ID 查找
images、videos海报、背景图、预告片TMDB 图片 URL、TMDB 预告片 API
keywords、translations标签和译文关键词 API、译文 API
content_ratings、alternative_titles、episode_groups、lists、watch/providers、similar、recommendations、reviews上表中的子资源本页
ratings、moods、soundtracks、wikidata、showtimesamodb 扩展评分、情绪、原声配乐、放映场次

剧集页面很适合用一次合并调用。下表对比同样的数据用合并调用和分开调用的差别。

目标调用占用请求数
只要剧集详情/tv/13961
一次调用取得详情、分级、演职员和评分/tv/1396?append_to_response=content_ratings,credits,ratings1
同样四个数据块分开调用/tv/1396、/content_ratings、/credits、/ratings4
详情加全部 5 季/tv/1396,然后 /tv/1396/season/1 到 /season/56

这和 TMDB 的剧集接口有什么不同?

路径、查询参数和 JSON 字段都相同,所以 TMDB 客户端只需换基础 URL 和密钥。TMDB 的数据来自它的 API 条款,读取于 2026-10-19。

项目TMDBamodb
基础 URLhttps://api.themoviedb.org/3https://api.amodb.dev/3
GET /tv/{series_id} 及其子资源TMDB v3 中有提供,字段相同
aggregate_credits、changesTMDB v3 中有不提供
响应中的评分vote_average、vote_count相同,另可通过 append_to_response 取得五个来源的 ratings
速率限制每个 IP 约每秒 40 个请求,TMDB 称可能会调整按账户计,每分钟 20、40 或 120 个请求
标志或署名TMDB 条款要求显示 TMDB 标志、非官方认可声明,并为观看平台数据注明 JustWatch不要求 amodb 标志;注明 JustWatch,授权的文本和图片按标注署名

个人项目还是商业项目?

TMDB 只在你的应用没有收入时免费。广告、应用内购买、捐赠和订阅都算作有收入,TMDB 工作人员给出的价格是对年收入低于 $1M 的公司每月 $149(2026-03-31)。amodb 每月 $5.19 起,对商业使用不额外收费,不要求 amodb 标志或署名行。第三方署名仍然适用:展示观看渠道数据请注明 JustWatch,文本或图片带有 attribution 署名信息时,请在展示处一并显示。见 amodb 定价和 TMDB API 替代方案页面。

剧集 API 会返回哪些错误?

失败的调用返回 TMDB 的错误响应体。错误的 ID 会得到 status_code 34,消息为 "The resource you requested could not be found."。

HTTPstatus_code何时出现
4017密钥缺失或错误。
40236套餐周期已结束。
40434没有该 ID 的剧集、成人作品,或该路径不提供。
40537你调用了给剧集评分这类写入方法。
42925超过每分钟请求数。请等待 Retry-After 秒。

完整列表见错误码,各套餐的限制见速率限制。

实用说明