Bowmark AIdocs

Twitch

Twitch — cut a Highlight of your own broadcast, including the one still live, and read any public video's length and status.

Domain: twitch.tv

Also known as: twitch, twitch.tv, Twitch Interactive

Prefer the capability

bowmark.stream_highlights covers this provider and routes around it when it is having a bad day. Reach for this page when you need twitch.tv specifically.

Call it directly

bowmark.providers.twitch.getVideo(args: GetVideoArgs): Promise<TwitchVideo>
bowmark.providers.twitch.createHighlight(args: CreateHighlightArgs): Promise<TwitchHighlight>

Functions

FunctionWhat it does
getVideoReads one public Twitch video by id or twitch.tv/videos link — title, length in seconds, whether it is still RECORDING (a live broadcast's archive) or RECORDED, its type (ARCHIVE,…
createHighlightCuts a permanent Highlight from the signed-in streamer's own broadcast — including the one still live — between two offsets in seconds, with a title.

Types

interface TwitchVideo {
  id: string;
  title: string;
  /** Seconds. For a live archive this GROWS, trailing real time by a minute or two. */
  lengthSeconds: number;
  /** "RECORDING" while the broadcast is live, "RECORDED" after. */
  status: string;
  /** "ARCHIVE" (a past broadcast), "HIGHLIGHT" or "UPLOAD". */
  type: string;
  createdAt: string;
  ownerLogin: string;
  url: string;
}
interface GetVideoArgs {
  /** A Twitch video id, or a twitch.tv/videos/<id> link. */
  vodId: string;
}
interface CreateHighlightArgs {
  /** The broadcast to cut from — an id or a twitch.tv/videos/<id> link. Omit it
   * for the signed-in channel's NEWEST archive, which during a broadcast is the
   * live one. */
  vodId?: string;
  /** Seconds into that video. Rounded outward to whole seconds. */
  startSeconds: number;
  endSeconds: number;
  title: string;
  description?: string;
  /** Default "en". */
  language?: string;
  tags?: string[];
  /** Category name, e.g. "Wetrix". */
  game?: string;
}
interface TwitchHighlight {
  /** "created" by this call; "existing" when a highlight with this exact title
   * was already on the channel (nothing new made); "unknown" when the request
   * went out and no answer came back — check dashboardUrl before retrying. */
  status: "created" | "existing" | "unknown";
  highlightId: string | null;
  url: string | null;
  title: string;
  vodId: string;
  startSeconds: number;
  endSeconds: number;
  channel: string;
  dashboardUrl: string;
}
stream_highlightsStream highlights — cut a highlight of your own live broadcast — the capability this provider backs.