Cache requests
This commit is contained in:
1 parent
bda632b256
commit
bad84da75a
2 files changed
+8
-4
No files matched your search
@@ -10,9 +10,6 @@ namespace Invidious
|
||||
' TODO: query server status, check if it supports APIs and/or signups
|
||||
const TOKEN_CALLBACK = "/invidious/token_callback"
|
||||
|
||||
const POPULAR_ENDPOINT = "/api/v1/popular"
|
||||
const TRENDING_ENDPOINT = "/api/v1/trending"
|
||||
|
||||
const VIDEOS_ENDPOINT = "/api/v1/videos"
|
||||
|
||||
const SEARCH_SUGGEST_ENDPOINT = "/api/v1/search/suggestions"
|
||||
@@ -45,6 +42,8 @@ namespace Invidious
|
||||
url = `${instance}${Invidious.VIDEOS_ENDPOINT}/${videoId}`
|
||||
|
||||
args = Invidious.DefaultArgs()
|
||||
args.cacheSeconds = 60 * 60 * 6 ' 6 hours
|
||||
|
||||
response = Requests().get(url, args)
|
||||
|
||||
return {
|
||||
@@ -60,6 +59,8 @@ namespace Invidious
|
||||
|
||||
args = Invidious.DefaultArgs()
|
||||
args.params.q = q
|
||||
args.cacheSeconds = 60 * 60 * 6 ' 6 hours
|
||||
|
||||
response = Requests().get(url, args)
|
||||
|
||||
if response.statuscode = 200
|
||||
|
||||
@@ -72,7 +72,10 @@ namespace InvidiousSettings
|
||||
if m.invidiousPublicInstances <> invalid
|
||||
return m.invidiousPublicInstances
|
||||
end if
|
||||
response = Requests().get(InvidiousSettings.INSTANCES_API)
|
||||
args = {
|
||||
cacheSeconds: 60 * 60 * 6 ' 6 hours
|
||||
}
|
||||
response = Requests().get(InvidiousSettings.INSTANCES_API, args)
|
||||
if response.statuscode = 200
|
||||
json = response.json
|
||||
instances = []
|
||||
|
||||
Reference in new issue
Block a user