add cachefixer

This commit is contained in:
Ashley 2023-11-12 11:55:43 +00:00
parent f435cfe7fe
commit 572cfcaf2b

View file

@ -41,24 +41,12 @@ class PokeTubeDislikesAPIManager {
* @private
*/
async _getEngagementData() {
const fallbackUrl = `https://returnyoutubedislikeapi.com/votes?videoId=${this.videoId}`;
const fallbackUrl = `https://returnyoutubedislikeapi.com/votes?videoId=${this.videoId}&cachefixer=${btoa(Date.now())}`;
const { fetch } = await import("undici");
// why RYD? why... do i have to this lol?
for (let i = 0; i < 2; i++) {
try {
const engagement = await fetch(fallbackUrl).then((res) => res.json());
return engagement;
} catch (err) {
if (err.status === 503) {
// retry after a bit
await new Promise((resolve) => setTimeout(resolve, 1000));
} else {
throw err;
}
}
}
}
/**