feat: add support for uploading videos (#115)

* chore: add video upload url

* feat!: add support for uploading videos

This is probably complete but I will do a self-review later today.

* style: align comments

* style: lint code

* chore: tidy things up
This commit is contained in:
LuanRT
2022-07-25 04:45:55 -03:00
committed by GitHub
parent 616b1405c3
commit 95079ced09
5 changed files with 167 additions and 7 deletions

View File

@@ -65,7 +65,9 @@ export default class HTTPClient {
let request_body = body;
const is_innertube_req = baseURL === innertube_url;
const is_innertube_req =
baseURL === innertube_url ||
baseURL === Constants.URLS.YT_UPLOAD;
// Copy context into payload when possible
if (content_type === 'application/json' && is_innertube_req && (typeof body === 'string')) {
@@ -120,7 +122,7 @@ export default class HTTPClient {
// Check if 2xx
if (response.ok) {
return response;
} throw new InnertubeError(`Request to ${response.url} failed with status ${response.status}`, await response.json());
} throw new InnertubeError(`Request to ${response.url} failed with status ${response.status}`, await response.text());
}
#adjustContext(ctx: Context, client: string) {
@@ -138,4 +140,4 @@ export default class HTTPClient {
break;
}
}
}
}