API
电影的 base.json 包含其语言无关数据和演职人员;名称和简介位于语言文件中。
文件
https://api.watchittrackit.com/v1/movie/{id}/base.jsonhttps://api.watchittrackit.com/v1/movie/{id}/{lang}.jsonhttps://api.watchittrackit.com/v1/movie/slugs/{shard}.json
图片是一个包含 full 和 thumb 路径的对象。
base.json
| 字段 | 类型 | 说明 |
|---|---|---|
| type | string | 记录类型。 |
| id | number | TheTVDB id。 |
| slug | string | URL slug,在同一类型内唯一。 |
| popularity | number | TheTVDB 热度分数,越高越热门。分数仅在同一类型内可比较。 |
| deleted | boolean | 如果记录已被删除则为 true。其文件仍保持发布。 |
| released | string | 上映日期(YYYY-MM-DD)。 |
| runtime | number | 时长(分钟)。 |
| image | image | 主图:作品为海报,人物为照片。 |
| images | { [kind]: image } | 每种类型中最佳的图片:poster, background, banner, icon, clearart, clearlogo。 |
| imagesByLang | { [kind]: image[] } | 按类型列出每种语言中最佳的图片,附带语言代码、尺寸和分数。 |
| cast | credit[] | 演员,按署名顺序排列。 |
| crew | credit[] | 其他所有署名人员及其职务。 |
| topBilledIds | number[] | 需优先展示的人物 id。 |
| genres | string[] | 类型 slug,按 TheTVDB 的定义。 |
| languages | string[] | 此记录拥有文件的语言。 |
| remoteIds | { [site]: string } | 在其他网站(imdb, tmdb, wikidata, …)上的 id,以网站为键。 |
示例
{
"type": "movie",
"id": 16612,
"slug": "barbie",
"popularity": 1213687,
"deleted": false,
"released": "2023-07-18",
"runtime": 114,
"images": {
"poster": { "full": "/images/movie/16612/poster/64ba61bb1dc73.jpg", "thumb": "/images/movie/16612/poster/64ba61bb1dc73.t.jpg" }
},
"imagesByLang": {
"poster": [{ "full": "/images/movie/16612/poster/64ba61bb1dc73.jpg", "thumb": "…", "lang": "eng", "width": 680, "height": 1000, "score": 100007 }]
},
"cast": [
{ "id": 327479, "activityId": 44, "role": "Barbie", "slug": "margot-robbie", "topBilled": true, "deleted": false }
],
"crew": [
{ "id": 569546, "activityId": 93, "job": "producer", "slug": "walter-f-parkes", "topBilled": false, "deleted": false }
],
"topBilledIds": [327479],
"genres": ["adventure", "comedy", "fantasy"],
"languages": ["de", "en", "fr"],
"remoteIds": { "imdb": "tt1517268", "tmdb": "346698" }
}演职人员
cast 和 crew 中的每一项:
| 字段 | 类型 | 说明 |
|---|---|---|
| id | number | 人物 id。 |
| activityId | number | 职员表条目 id,每个条目唯一。 |
| role | string | 饰演的角色(演员)。 |
| job | string | 职务(职员):director, writer, producer, … |
| slug | string | 该人物的 slug。 |
| image | image | 该人物的照片。 |
| topBilled | boolean | 重点展示的条目。 |
| deleted | boolean | 如果该人物已被删除则为 true。 |
语言文件
| 字段 | 类型 | 说明 |
|---|---|---|
| type | string | 记录类型。 |
| id | number | TheTVDB id。 |
| lang | string | 此文件的语言。 |
| name | string | 此语言下的名称。 |
| overview | string | 此语言下的简介。 |
| credits | { [personId]: { name, role } } | 按人物 id:其在此语言下的名称和角色。 |
示例
{
"type": "movie",
"id": 16612,
"lang": "en",
"name": "Barbie",
"overview": "Barbie and Ken are having the time of their lives…",
"credits": { "327479": { "name": "Margot Robbie", "role": "Barbie" } }
}通过 slug 查找作品
剧集和电影的 URL 使用 slug(breaking-bad)。slug 索引将每个 slug 映射到其 id,并拆分为 256 个小文件:slug 所在文件以该 slug 的 SHA-1 值的前两个十六进制字符命名。
// Node.js
import { createHash } from "node:crypto"
const slug = "barbie"
const shard = createHash("sha1").update(slug, "utf8").digest("hex").slice(0, 2)
const index = await fetch(`https://api.watchittrackit.com/v1/movie/slugs/${shard}.json`).then((r) => r.json())
const id = index[slug]
const record = await fetch(`https://api.watchittrackit.com/v1/movie/${id}/base.json`).then((r) => r.json())