mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-26 15:38:14 +01:00
change function name uwu
This commit is contained in:
parent
aee34728fe
commit
90ca462159
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) => {
|
||||||
|
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,
|
||||||
|
|
Loading…
Reference in a new issue