Add stats endpoint
This commit is contained in:
1 parent
0c508f4582
commit
8a251b90db
1 file changed
+14
-1
@@ -7,9 +7,11 @@ import "pkg:/source/utils/WebUtils.bs"
|
||||
import "pkg:/source/services/InvidiousSettings.bs"
|
||||
|
||||
namespace Invidious
|
||||
' TODO: query server status, check if it supports APIs and/or signups
|
||||
const TOKEN_CALLBACK = "/invidious/token_callback"
|
||||
|
||||
' TODO: query server status, check if it supports APIs and/or signups
|
||||
const STATS_ENDPOINT = "/api/v1/stats"
|
||||
|
||||
const VIDEOS_ENDPOINT = "/api/v1/videos"
|
||||
|
||||
const SEARCH_SUGGEST_ENDPOINT = "/api/v1/search/suggestions"
|
||||
@@ -28,6 +30,17 @@ namespace Invidious
|
||||
}
|
||||
end function
|
||||
|
||||
function GetServerStats() as object
|
||||
instance = InvidiousSettings.GetSelectedInstance()
|
||||
url = `${instance}${Invidious.STATS_ENDPOINT}`
|
||||
|
||||
response = Requests().get(url)
|
||||
if response.statuscode = 200
|
||||
return response.json
|
||||
end if
|
||||
return invalid
|
||||
end function
|
||||
|
||||
function GetVideoUrl(videoId as string, itag as string, local as boolean) as string
|
||||
instance = InvidiousSettings.GetSelectedInstance()
|
||||
url = `${instance}/latest_version?id=${videoId}&itag=${itag}`
|
||||
|
||||
Reference in new issue
Block a user