From da714f423cc975339826c02ac751013c27d4f059 Mon Sep 17 00:00:00 2001 From: "koffee.zip" Date: Wed, 15 Jul 2026 22:07:33 -0600 Subject: [PATCH] Idk how to explain ts --- src/rete.cr | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/rete.cr b/src/rete.cr index 8427ffc..e4a16cf 100644 --- a/src/rete.cr +++ b/src/rete.cr @@ -63,22 +63,27 @@ working = 0 notWorking = 0 config = File.read("config.txt") -while repeat < ARGV.size - if Valid.url? ARGV[repeat] - response = HTTP::Client.get(ARGV[repeat]) - if config.includes?(response.status_code.to_s) - puts "#{ARGV[repeat]} is a valid URL and works. Status code: #{response.status_code}" - working += 1 + while repeat < ARGV.size + if Valid.url? ARGV[repeat] + begin + response = HTTP::Client.get(ARGV[repeat]) + if config.includes?(response.status_code.to_s) + puts "#{ARGV[repeat]} is a valid URL and works. Status code: #{response.status_code}" + working += 1 + else + puts "#{ARGV[repeat]} is a valid URL but does not work. Status Code: #{response.status_code}" + notWorking += 1 + end + rescue Socket::Addrinfo::Error + puts "#{ARGV[repeat]} is a valid URL but does not exist." + notWorking += 1 + end else - puts "#{ARGV[repeat]} is a valid URL but does not work. Status Code: #{response.status_code}" + puts "#{ARGV[repeat]} is not a valid URL" notWorking += 1 end - elsif - puts "#{ARGV[repeat]} is not a valid URL" - notWorking += 1 + repeat += 1 end -repeat += 1 -end puts "==============================" puts "Finished testing urls."