2021-07-09 03:21:10 -05:00
|
|
|
|
|
|
|
import { HttpStatusCode } from '../../core-utils/miscs/http-error-codes'
|
|
|
|
import { unwrapBody, unwrapText } from '../requests'
|
|
|
|
import { AbstractCommand, OverrideCommandOptions } from '../shared'
|
|
|
|
|
|
|
|
export class StreamingPlaylistsCommand extends AbstractCommand {
|
|
|
|
|
|
|
|
get (options: OverrideCommandOptions & {
|
|
|
|
url: string
|
|
|
|
}) {
|
|
|
|
return unwrapText(this.getRawRequest({
|
|
|
|
...options,
|
|
|
|
|
|
|
|
url: options.url,
|
|
|
|
implicitToken: false,
|
|
|
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
|
|
|
}))
|
|
|
|
}
|
|
|
|
|
|
|
|
getSegment (options: OverrideCommandOptions & {
|
|
|
|
url: string
|
|
|
|
range?: string
|
|
|
|
}) {
|
2021-07-09 09:23:01 -05:00
|
|
|
return unwrapBody<Buffer>(this.getRawRequest({
|
2021-07-09 03:21:10 -05:00
|
|
|
...options,
|
|
|
|
|
|
|
|
url: options.url,
|
|
|
|
range: options.range,
|
|
|
|
implicitToken: false,
|
2021-07-09 07:15:11 -05:00
|
|
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
2021-07-09 03:21:10 -05:00
|
|
|
}))
|
|
|
|
}
|
|
|
|
|
|
|
|
getSegmentSha256 (options: OverrideCommandOptions & {
|
|
|
|
url: string
|
|
|
|
}) {
|
|
|
|
return unwrapBody<{ [ id: string ]: string }>(this.getRawRequest({
|
|
|
|
...options,
|
|
|
|
|
|
|
|
url: options.url,
|
|
|
|
implicitToken: false,
|
|
|
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
|
|
|
}))
|
|
|
|
}
|
|
|
|
}
|