mirror of
https://github.com/iv-org/instances-api.git
synced 2024-10-01 04:35:38 -04:00
commit
17e268574b
@ -50,9 +50,11 @@ spawn do
|
|||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
begin
|
||||||
body = HTTP::Client.get(URI.parse("https://raw.githubusercontent.com/iv-org/documentation/master/Invidious-Instances.md")).body
|
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
|
instances = {} of String => Instance
|
||||||
|
|
||||||
@ -73,7 +75,7 @@ spawn do
|
|||||||
client.connect_timeout = 5.seconds
|
client.connect_timeout = 5.seconds
|
||||||
client.read_timeout = 5.seconds
|
client.read_timeout = 5.seconds
|
||||||
begin
|
begin
|
||||||
stats = JSON.parse(client.get("/api/v1/stats", headers).body)
|
stats = JSON.parse(client.get("/api/v1/stats").body)
|
||||||
rescue ex
|
rescue ex
|
||||||
stats = nil
|
stats = nil
|
||||||
end
|
end
|
||||||
@ -87,7 +89,6 @@ spawn do
|
|||||||
INSTANCES.merge! instances
|
INSTANCES.merge! instances
|
||||||
|
|
||||||
sleep 5.minutes
|
sleep 5.minutes
|
||||||
Fiber.yield
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user