mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-17 10:34:38 -05:00
change function name uwu
This commit is contained in:
parent
b727347446
commit
0f0ffee4d1
1 changed files with 11 additions and 6 deletions
|
@ -21,10 +21,15 @@ const dislikeApi = "https://returnyoutubedislikeapi.com/votes?videoId=";
|
|||
const newApiUrl = "https://tube-srv.ashley143.gay/api/player";
|
||||
|
||||
const parseXml = async (videoId, headers) => {
|
||||
const player = await fetch(`${newApiUrl}?v=${videoId}`, headers);
|
||||
const xml = await player.text();
|
||||
const json = toJson(xml);
|
||||
return getJson(json);
|
||||
try {
|
||||
const player = await fetch(`${newApiUrl}?v=${videoId}`, headers);
|
||||
const xml = await player.text();
|
||||
const json = toJson(xml);
|
||||
return getJson(json);
|
||||
} catch (error) {
|
||||
console.error(`Error parsing XML: ${error}`);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
const getJson = (str) => {
|
||||
|
@ -35,7 +40,7 @@ const getJson = (str) => {
|
|||
}
|
||||
};
|
||||
|
||||
const getEngagement = async (videoId) => {
|
||||
const getEngagementData = async (videoId) => {
|
||||
const apiUrl = `${dislikeApi}${videoId}`;
|
||||
const fallbackUrl = `https://p.poketube.fun/${apiUrl}`;
|
||||
|
||||
|
@ -56,7 +61,7 @@ const getEngagement = async (videoId) => {
|
|||
const getPokeTubeData = async (videoId) => {
|
||||
const headers = {};
|
||||
const videoData = await parseXml(videoId, headers);
|
||||
const engagement = await getEngagement(videoId);
|
||||
const engagement = await getEngagementData(videoId);
|
||||
|
||||
return {
|
||||
video: videoData,
|
||||
|
|
Loading…
Reference in a new issue