mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-17 09:34:41 -05:00
use config.invidapi instead
This commit is contained in:
parent
fe86bf06ca
commit
1c6673f62e
1 changed files with 8 additions and 3 deletions
|
@ -109,13 +109,18 @@ async getYouTubeApiVideo(f, v, contentlang, contentregion) {
|
||||||
}
|
}
|
||||||
|
|
||||||
let retryCount = 0;
|
let retryCount = 0;
|
||||||
while (vid.error && retryCount < 2) {
|
while (vid.error && retryCount < 1) {
|
||||||
console.log(`Retrying fetching videoInfo... Retry ${retryCount + 1}`);
|
console.log(`Retrying fetching videoInfo from iv.ggtyler.dev... Retry ${retryCount + 1}`);
|
||||||
const retryVideoInfo = await fetch(`https://iv.ggtyler.dev/api/v1/videos/${v}?hl=${contentlang}®ion=${contentregion}&h=${btoa(Date.now())}`).then((res) => res.text());
|
const retryVideoInfo = await fetch(`https://iv.ggtyler.dev/api/v1/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