0

Get details about videos

by
Published Oct 17, 2025

This endpoint shows information about a video, including URLs to previews and the sizes that it is available in.

Script shutterstock Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Shutterstock = {
3
  token: string;
4
};
5
/**
6
 * Get details about videos
7
 * This endpoint shows information about a video, including URLs to previews and the sizes that it is available in.
8
 */
9
export async function main(
10
  auth: Shutterstock,
11
  id: string,
12
  language:
13
    | "ar"
14
    | "bg"
15
    | "bn"
16
    | "cs"
17
    | "da"
18
    | "de"
19
    | "el"
20
    | "en"
21
    | "es"
22
    | "fi"
23
    | "fr"
24
    | "gu"
25
    | "he"
26
    | "hi"
27
    | "hr"
28
    | "hu"
29
    | "id"
30
    | "it"
31
    | "ja"
32
    | "kn"
33
    | "ko"
34
    | "ml"
35
    | "mr"
36
    | "nb"
37
    | "nl"
38
    | "or"
39
    | "pl"
40
    | "pt"
41
    | "ro"
42
    | "ru"
43
    | "sk"
44
    | "sl"
45
    | "sv"
46
    | "ta"
47
    | "te"
48
    | "th"
49
    | "tr"
50
    | "uk"
51
    | "ur"
52
    | "vi"
53
    | "zh"
54
    | "zh-Hant"
55
    | undefined,
56
  view: "minimal" | "full" | undefined,
57
  search_id: string | undefined,
58
) {
59
  const url = new URL(`https://api.shutterstock.com/v2/videos/${id}`);
60
  for (const [k, v] of [
61
    ["language", language],
62
    ["view", view],
63
    ["search_id", search_id],
64
  ]) {
65
    if (v !== undefined && v !== "" && k !== undefined) {
66
      url.searchParams.append(k, v);
67
    }
68
  }
69
  const response = await fetch(url, {
70
    method: "GET",
71
    headers: {
72
      Authorization: "Bearer " + auth.token,
73
    },
74
    body: undefined,
75
  });
76
  if (!response.ok) {
77
    const text = await response.text();
78
    throw new Error(`${response.status} ${text}`);
79
  }
80
  return await response.json();
81
}
82