Watch It? Track It.

电影的 base.json 包含其语言无关数据和演职人员;名称和简介位于语言文件中。

文件

  • https://api.watchittrackit.com/v1/movie/{id}/base.json
  • https://api.watchittrackit.com/v1/movie/{id}/{lang}.json
  • https://api.watchittrackit.com/v1/movie/slugs/{shard}.json

图片是一个包含 full 和 thumb 路径的对象。

base.json

字段类型说明
typestring记录类型。
idnumberTheTVDB id。
slugstringURL slug,在同一类型内唯一。
popularitynumberTheTVDB 热度分数,越高越热门。分数仅在同一类型内可比较。
deletedboolean如果记录已被删除则为 true。其文件仍保持发布。
releasedstring上映日期(YYYY-MM-DD)。
runtimenumber时长(分钟)。
imageimage主图:作品为海报,人物为照片。
images{ [kind]: image }每种类型中最佳的图片:poster, background, banner, icon, clearart, clearlogo。
imagesByLang{ [kind]: image[] }按类型列出每种语言中最佳的图片,附带语言代码、尺寸和分数。
castcredit[]演员,按署名顺序排列。
crewcredit[]其他所有署名人员及其职务。
topBilledIdsnumber[]需优先展示的人物 id。
genresstring[]类型 slug,按 TheTVDB 的定义。
languagesstring[]此记录拥有文件的语言。
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 中的每一项:

字段类型说明
idnumber人物 id。
activityIdnumber职员表条目 id,每个条目唯一。
rolestring饰演的角色(演员)。
jobstring职务(职员):director, writer, producer, …
slugstring该人物的 slug。
imageimage该人物的照片。
topBilledboolean重点展示的条目。
deletedboolean如果该人物已被删除则为 true。

语言文件

字段类型说明
typestring记录类型。
idnumberTheTVDB id。
langstring此文件的语言。
namestring此语言下的名称。
overviewstring此语言下的简介。
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())