mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-22 05:58:14 +00:00
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:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user