mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-22 17:17:49 +01:00
h
This commit is contained in:
parent
38a624bd48
commit
23e742697a
1 changed files with 5 additions and 9 deletions
|
@ -108,19 +108,15 @@ async getYouTubeApiVideo(f, v, contentlang, contentregion) {
|
||||||
var p = this.getJson(await channel_uploads.text());
|
var p = this.getJson(await channel_uploads.text());
|
||||||
}
|
}
|
||||||
|
|
||||||
let retryCount = 0;
|
// Retry fetching videoInfo if vid is null, limited to 3 retries
|
||||||
while (vid.error && retryCount < 2) {
|
let retryCount = 0;
|
||||||
console.log(`Retrying: ${retryCount + 1}`);
|
while (vid.error && retryCount < 1) {
|
||||||
const retryVideoInfo = await fetch(`https://par1.iv.ggtyler.dev/api/v1/videos/${v}?hl=${contentlang}®ion=${contentregion}&h=${btoa(Date.now())}`).then((res) => res.text());
|
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);
|
vid = await this.getJson(retryVideoInfo);
|
||||||
retryCount++;
|
retryCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vid.error) {
|
|
||||||
const fallbackVideoInfo = await fetch(`${this.config.invapi}/videos/${v}?hl=${contentlang}®ion=${contentregion}&h=${btoa(Date.now())}`).then((res) => res.text());
|
|
||||||
vid = await this.getJson(fallbackVideoInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
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`
|
||||||
|
|
Loading…
Reference in a new issue