change function name uwu

This commit is contained in:
Ashley 2023-03-04 14:08:54 +00:00
parent aee34728fe
commit 90ca462159

View file

@ -21,10 +21,15 @@ const dislikeApi = "https://returnyoutubedislikeapi.com/votes?videoId=";
const newApiUrl = "https://tube-srv.ashley143.gay/api/player"; const newApiUrl = "https://tube-srv.ashley143.gay/api/player";
const parseXml = async (videoId, headers) => { const parseXml = async (videoId, headers) => {
try {
const player = await fetch(`${newApiUrl}?v=${videoId}`, headers); const player = await fetch(`${newApiUrl}?v=${videoId}`, headers);
const xml = await player.text(); const xml = await player.text();
const json = toJson(xml); const json = toJson(xml);
return getJson(json); return getJson(json);
} catch (error) {
console.error(`Error parsing XML: ${error}`);
return null;
}
}; };
const getJson = (str) => { const getJson = (str) => {
@ -35,7 +40,7 @@ const getJson = (str) => {
} }
}; };
const getEngagement = async (videoId) => { const getEngagementData = async (videoId) => {
const apiUrl = `${dislikeApi}${videoId}`; const apiUrl = `${dislikeApi}${videoId}`;
const fallbackUrl = `https://p.poketube.fun/${apiUrl}`; const fallbackUrl = `https://p.poketube.fun/${apiUrl}`;
@ -56,7 +61,7 @@ const getEngagement = async (videoId) => {
const getPokeTubeData = async (videoId) => { const getPokeTubeData = async (videoId) => {
const headers = {}; const headers = {};
const videoData = await parseXml(videoId, headers); const videoData = await parseXml(videoId, headers);
const engagement = await getEngagement(videoId); const engagement = await getEngagementData(videoId);
return { return {
video: videoData, video: videoData,