I;m to tierd to explain

This commit is contained in:
2026-07-16 01:17:20 -06:00
parent e764dcceb3
commit 678aa1f70d
+47 -26
View File
@@ -93,32 +93,53 @@ end
repeat = 0 repeat = 0
working = 0 working = 0
notWorking = 0 notWorking = 0
config = File.read("config.txt") exist = true
while repeat < ARGV.size begin
if Valid.url? ARGV[repeat] config = File.read("config.txt")
begin rescue File::NotFoundError
response = HTTP::Client.get(ARGV[repeat]) puts "Oh No! It seems that your config.txt file does not exist!"
if config.includes?(response.status_code.to_s) puts "This is required for rete to know what classifies if a url is working or not!"
puts "#{ARGV[repeat]} is a valid URL and works. Status code: #{response.status_code}" puts "You can fix this by creating a config.txt file and by then entering status codes you classify as \"working\""
working += 1 exit(1)
else end
puts "#{ARGV[repeat]} is a valid URL but does not work. Status Code: #{response.status_code}"
notWorking += 1 while repeat < ARGV.size
end begin
rescue Socket::Addrinfo::Error validUrl = Valid.url? ARGV[repeat]
puts "#{ARGV[repeat]} is a valid URL but does not exist." rescue Regex::Error
notWorking += 1 validUrl = false
end
else
puts "#{ARGV[repeat]} is not a valid URL"
notWorking += 1
end
repeat += 1
end end
puts "==============================" if validUrl == true
puts "Finished testing urls." begin
puts "A total of #{repeat} url(s) were tested." STDIN.read_timeout = 1
puts "#{working}/#{repeat} url(s) were working." uri = URI.parse(ARGV[repeat])
puts "#{notWorking}/#{repeat} url(s) were not working." client = HTTP::Client.new(uri)
client.connect_timeout = urlTimeout.to_i.seconds
response = client.get("/")
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
puts "#{ARGV[repeat]} is a valid URL but does not exist."
notWorking += 1
end
else
puts "#{ARGV[repeat]} is not a valid URL"
notWorking += 1
end
repeat += 1
end
puts "=============================="
puts "Finished testing urls."
puts "A total of #{repeat} url(s) were tested."
puts "#{working}/#{repeat} url(s) were working."
puts "#{notWorking}/#{repeat} url(s) were not working."
exit 0