mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-22 22:37:56 +01:00
test ignore
This commit is contained in:
parent
61fb7ee345
commit
a68fcde7f9
1 changed files with 71 additions and 64 deletions
|
@ -67,7 +67,7 @@ class InnerTubePokeVidious {
|
||||||
* @param {string} v - Video ID.
|
* @param {string} v - Video ID.
|
||||||
* @returns {Promise<object>} Promise resolving to the video information.
|
* @returns {Promise<object>} Promise resolving to the video information.
|
||||||
*/
|
*/
|
||||||
async getYouTubeApiVideo(f, v, contentlang, contentregion) {
|
async getYouTubeApiVideo(f, v, contentlang, contentregion) {
|
||||||
|
|
||||||
const { fetch } = await import("undici");
|
const { fetch } = await import("undici");
|
||||||
|
|
||||||
|
@ -96,13 +96,11 @@ class InnerTubePokeVidious {
|
||||||
}),
|
}),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
const comments = await this.getJson(invComments);
|
const comments = await this.getJson(invComments);
|
||||||
|
let vid = await this.getJson(videoInfo);
|
||||||
const vid = await this.getJson(videoInfo);
|
|
||||||
const { json, video } = videoData;
|
const { json, video } = videoData;
|
||||||
|
|
||||||
var channel_uploads = { };
|
var channel_uploads = {};
|
||||||
if (f == "true") {
|
if (f == "true") {
|
||||||
channel_uploads = await fetch(
|
channel_uploads = await fetch(
|
||||||
`${this.config.invapi}/channels/${vid.authorId}?hl=${contentlang}®ion=${contentregion}`
|
`${this.config.invapi}/channels/${vid.authorId}?hl=${contentlang}®ion=${contentregion}`
|
||||||
|
@ -110,6 +108,15 @@ class InnerTubePokeVidious {
|
||||||
var p = this.getJson(await channel_uploads.text());
|
var p = this.getJson(await channel_uploads.text());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Retry fetching videoInfo if vid is null, limited to 3 retries
|
||||||
|
let retryCount = 0;
|
||||||
|
while (!vid && retryCount < 3) {
|
||||||
|
console.log(`Retrying fetching videoInfo... Retry ${retryCount + 1}`);
|
||||||
|
const retryVideoInfo = await fetch(`${this.config.invapi}/videos/${v}?hl=${contentlang}®ion=${contentregion}&h=${btoa(Date.now())}`).then((res) => res.text());
|
||||||
|
vid = await this.getJson(retryVideoInfo);
|
||||||
|
retryCount++;
|
||||||
|
}
|
||||||
|
|
||||||
if (!vid) {
|
if (!vid) {
|
||||||
console.log(
|
console.log(
|
||||||
`Sorry nya, we couldn't find any information about that video qwq`
|
`Sorry nya, we couldn't find any information about that video qwq`
|
||||||
|
@ -151,7 +158,7 @@ class InnerTubePokeVidious {
|
||||||
} catch {
|
} catch {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue