mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-10 15:08:26 +01:00
improve return youtube dislike API
This commit is contained in:
parent
0dfe5317af
commit
53f57c6354
1 changed files with 18 additions and 12 deletions
|
@ -24,19 +24,13 @@ var dislike_api = `https://returnyoutubedislikeapi.com/votes?videoId=`;
|
|||
var new_api_url = `https://tube-srv.ashley143.gay/api/player`;
|
||||
|
||||
module.exports = async function (video_id) {
|
||||
|
||||
function getJson(str) {
|
||||
try {
|
||||
return JSON.parse(str);
|
||||
} catch {
|
||||
return null;
|
||||
function getJson(str) {
|
||||
try {
|
||||
return JSON.parse(str);
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const engagement = await fetch(`${dislike_api}${video_id}`).then((res) =>
|
||||
res.json()
|
||||
);
|
||||
|
||||
|
||||
const headers = {};
|
||||
/*
|
||||
|
@ -50,6 +44,17 @@ function getJson(str) {
|
|||
return getJson(j);
|
||||
}
|
||||
|
||||
async function ryd() {
|
||||
try {
|
||||
const engagement = await fetch(`${dislike_api}${video_id}`).then((res) =>
|
||||
res.json()
|
||||
);
|
||||
return engagement;
|
||||
} catch {}
|
||||
}
|
||||
|
||||
const engagement = await ryd();
|
||||
|
||||
/*
|
||||
* Returner object
|
||||
*/
|
||||
|
@ -58,5 +63,6 @@ function getJson(str) {
|
|||
engagement,
|
||||
video_url_youtube: `${youtube_url}${video_id}`,
|
||||
};
|
||||
|
||||
return returner;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue