0
0
Fork 0
mirror of https://github.com/VueTubeApp/VueTube synced 2024-11-16 16:25:17 +00:00

feat: youtube API communications working

This commit is contained in:
Alex 2022-03-17 11:34:58 +13:00
parent dba23bec6b
commit ead8b037f5

View file

@ -19,8 +19,8 @@ class Innertube {
if (data.INNERTUBE_CONTEXT) { if (data.INNERTUBE_CONTEXT) {
this.key = data.INNERTUBE_API_KEY; this.key = data.INNERTUBE_API_KEY;
this.context = data.INNERTUBE_CONTEXT; this.context = data.INNERTUBE_CONTEXT;
this.context.clientName = "ANDROID"; this.context["clientName"] = "ANDROID";
this.context.clientVersion = "16.25"; this.context["clientVersion"] = "16.25";
} }
} catch (err) { } catch (err) {
@ -54,12 +54,8 @@ class Innertube {
const response = await Http.post({ const response = await Http.post({
url: `https://www.youtube.com/youtubei/v1/browse?key=${this.key}`, url: `https://www.youtube.com/youtubei/v1/browse?key=${this.key}`,
data: JSON.stringify(data), data: data,
headers: { headers: { "Content-Type": "application/json" }
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "DELETE, POST, GET, OPTIONS",
"Access-Control-Allow-Headers": "Content-Type, Authorization, X-Requested-With"
}
}).catch((error) => error); }).catch((error) => error);
if (response instanceof Error) return { success: false, status_code: response.response.status, message: response.message }; if (response instanceof Error) return { success: false, status_code: response.response.status, message: response.message };