diff options
Diffstat (limited to 'shared/extra-utils/videos/streaming-playlists-command.ts')
-rw-r--r-- | shared/extra-utils/videos/streaming-playlists-command.ts | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/shared/extra-utils/videos/streaming-playlists-command.ts b/shared/extra-utils/videos/streaming-playlists-command.ts new file mode 100644 index 000000000..4caec7137 --- /dev/null +++ b/shared/extra-utils/videos/streaming-playlists-command.ts | |||
@@ -0,0 +1,45 @@ | |||
1 | |||
2 | import { HttpStatusCode } from '../../core-utils/miscs/http-error-codes' | ||
3 | import { unwrapBody, unwrapText } from '../requests' | ||
4 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | ||
5 | |||
6 | export class StreamingPlaylistsCommand extends AbstractCommand { | ||
7 | |||
8 | get (options: OverrideCommandOptions & { | ||
9 | url: string | ||
10 | }) { | ||
11 | return unwrapText(this.getRawRequest({ | ||
12 | ...options, | ||
13 | |||
14 | url: options.url, | ||
15 | implicitToken: false, | ||
16 | defaultExpectedStatus: HttpStatusCode.OK_200 | ||
17 | })) | ||
18 | } | ||
19 | |||
20 | getSegment (options: OverrideCommandOptions & { | ||
21 | url: string | ||
22 | range?: string | ||
23 | }) { | ||
24 | return unwrapText(this.getRawRequest({ | ||
25 | ...options, | ||
26 | |||
27 | url: options.url, | ||
28 | range: options.range, | ||
29 | implicitToken: false, | ||
30 | defaultExpectedStatus: HttpStatusCode.OK_200, | ||
31 | })) | ||
32 | } | ||
33 | |||
34 | getSegmentSha256 (options: OverrideCommandOptions & { | ||
35 | url: string | ||
36 | }) { | ||
37 | return unwrapBody<{ [ id: string ]: string }>(this.getRawRequest({ | ||
38 | ...options, | ||
39 | |||
40 | url: options.url, | ||
41 | implicitToken: false, | ||
42 | defaultExpectedStatus: HttpStatusCode.OK_200 | ||
43 | })) | ||
44 | } | ||
45 | } | ||