mirror of
				https://codeberg.org/ashley/poke
				synced 2025-07-17 16:52:11 +00:00 
			
		
		
		
	add engagement thingy
This commit is contained in:
		
							parent
							
								
									c19a4ea200
								
							
						
					
					
						commit
						49b037b129
					
				| @ -17,7 +17,7 @@ const fetch = require("node-fetch"); //2.5.x | ||||
| const { toJson } = require("xml2json"); | ||||
| 
 | ||||
| const youtubeUrl = "https://www.youtube.com/watch?v="; | ||||
| const dislikeApi = "https://p.poketube.fun/https://returnyoutubedislikeapi.com/votes?videoId="; | ||||
| const dislikeApi = "https://returnyoutubedislikeapi.com/votes?videoId="; | ||||
| const newApiUrl = "https://tube-srv.ashley143.gay/api/player"; | ||||
| 
 | ||||
| const parseXml = async (videoId, headers) => { | ||||
| @ -36,10 +36,23 @@ const getJson = (str) => { | ||||
| }; | ||||
| 
 | ||||
| const getEngagement = async (videoId) => { | ||||
|   const engagement = await fetch(`${dislikeApi}${videoId}`).then((res) => res.json()); | ||||
|   return engagement; | ||||
|   const apiUrl = `${dislikeApi}${videoId}`; | ||||
|   const fallbackUrl = `https://p.poketube.fun/${apiUrl}`; | ||||
| 
 | ||||
|   try { | ||||
|     const engagement = await fetch(apiUrl).then((res) => res.json()); | ||||
|     return engagement; | ||||
|   } catch { | ||||
|     try { | ||||
|       const engagement = await fetch(fallbackUrl).then((res) => res.json()); | ||||
|       return engagement; | ||||
|     } catch { | ||||
|       return; | ||||
|     } | ||||
|   } | ||||
| }; | ||||
| 
 | ||||
| 
 | ||||
| const getPokeTubeData = async (videoId) => { | ||||
|   const headers = {}; | ||||
|   const videoData = await parseXml(videoId, headers); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Ashley
						Ashley