From 215244e956d5f9edb0cb642ba7d13e40a6f5c4e6 Mon Sep 17 00:00:00 2001 From: Andrew Zhao Date: Wed, 10 Mar 2021 12:50:45 -0500 Subject: [PATCH] fixes --- src/instances.cr | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/instances.cr b/src/instances.cr index 49357db..f342c8e 100644 --- a/src/instances.cr +++ b/src/instances.cr @@ -50,9 +50,11 @@ spawn do break end end - - body = HTTP::Client.get(URI.parse("https://raw.githubusercontent.com/iv-org/documentation/master/Invidious-Instances.md")).body - headers = HTTP::Headers.new + begin + body = HTTP::Client.get(URI.parse("https://raw.githubusercontent.com/iv-org/documentation/master/Invidious-Instances.md")).body + 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