mirror of
https://codeberg.org/ashley/poke.git
synced 2024-12-24 19:58:42 +01:00
new dislikles lol
This commit is contained in:
parent
df6b4f0e5c
commit
c5a29ea7a2
1 changed files with 17 additions and 5 deletions
|
@ -40,16 +40,28 @@ class PokeTubeDislikesAPIManager {
|
|||
* @returns {Promise<object|null>} A Promise that resolves with the engagement data, or null if an error occurs.
|
||||
* @private
|
||||
*/
|
||||
async _getEngagementData() {
|
||||
const fallbackUrl = `https://prod-poketube.testing.poketube.fun/api?v=${this.videoId}`;
|
||||
async _getEngagementData() {
|
||||
const apiUrl = `http://prod-poketube.testing.poketube.fun/${this.videoId}&hash=d0550b6e28c8f93533a569c314d5b4e2`;
|
||||
const fallbackUrl = `https://returnyoutubedislikeapi.com/votes?videoId=${this.videoId}`;
|
||||
|
||||
const { fetch } = await import("undici");
|
||||
const { fetch } = await import("undici");
|
||||
|
||||
|
||||
const engagement = await fetch(fallbackUrl).then((res) => res.json());
|
||||
return engagement;
|
||||
try {
|
||||
const engagement = await fetch(fallbackUrl).then((res) => res.json());
|
||||
return engagement;
|
||||
} catch {
|
||||
try {
|
||||
const engagement = await fetch(apiUrl).then((res) => res.json());
|
||||
return engagement;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves data about the YouTube video and its engagement.
|
||||
* @returns {Promise<object>} A Promise that resolves with an object containing video and engagement data.
|
||||
|
|
Loading…
Reference in a new issue