mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-10 09:58:26 +01: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 newApiUrl = "https://tube-srv.ashley143.gay/api/player";
|
||||||
|
|
||||||
const parseXml = async (videoId, headers) => {
|
const parseXml = async (videoId, headers) => {
|
||||||
const player = await fetch(`${newApiUrl}?v=${videoId}`, headers);
|
try {
|
||||||
const xml = await player.text();
|
const player = await fetch(`${newApiUrl}?v=${videoId}`, headers);
|
||||||
const json = toJson(xml);
|
const xml = await player.text();
|
||||||
return getJson(json);
|
const json = toJson(xml);
|
||||||
|
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,
|
||||||
|
|
Loading…
Reference in a new issue