improve return youtube dislike API

This commit is contained in:
Ashley 2022-12-20 13:38:25 +00:00
parent 0dfe5317af
commit 53f57c6354

View file

@ -24,19 +24,13 @@ var dislike_api = `https://returnyoutubedislikeapi.com/votes?videoId=`;
var new_api_url = `https://tube-srv.ashley143.gay/api/player`; var new_api_url = `https://tube-srv.ashley143.gay/api/player`;
module.exports = async function (video_id) { module.exports = async function (video_id) {
function getJson(str) {
function getJson(str) {
try { try {
return JSON.parse(str); return JSON.parse(str);
} catch { } catch {
return null; return null;
} }
} }
const engagement = await fetch(`${dislike_api}${video_id}`).then((res) =>
res.json()
);
const headers = {}; const headers = {};
/* /*
@ -50,6 +44,17 @@ function getJson(str) {
return getJson(j); 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 * Returner object
*/ */
@ -58,5 +63,6 @@ function getJson(str) {
engagement, engagement,
video_url_youtube: `${youtube_url}${video_id}`, video_url_youtube: `${youtube_url}${video_id}`,
}; };
return returner; return returner;
}; };