Merge pull request #22 from tenpura-shrimp/master

fixes
This commit is contained in:
Perflyst 2021-04-27 19:47:08 +02:00 committed by GitHub
commit 17e268574b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -50,9 +50,11 @@ spawn do
break
end
end
begin
body = HTTP::Client.get(URI.parse("https://raw.githubusercontent.com/iv-org/documentation/master/Invidious-Instances.md")).body
headers = HTTP::Headers.new
rescue ex
body = ""
end
instances = {} of String => Instance
@ -73,7 +75,7 @@ spawn do
client.connect_timeout = 5.seconds
client.read_timeout = 5.seconds
begin
stats = JSON.parse(client.get("/api/v1/stats", headers).body)
stats = JSON.parse(client.get("/api/v1/stats").body)
rescue ex
stats = nil
end
@ -87,7 +89,6 @@ spawn do
INSTANCES.merge! instances
sleep 5.minutes
Fiber.yield
end
end