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:
parent
dba23bec6b
commit
ead8b037f5
1 changed files with 4 additions and 8 deletions
|
@ -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 };
|
||||||
|
|
Loading…
Reference in a new issue