Idk how to explain ts
This commit is contained in:
+9
-4
@@ -63,8 +63,9 @@ working = 0
|
|||||||
notWorking = 0
|
notWorking = 0
|
||||||
config = File.read("config.txt")
|
config = File.read("config.txt")
|
||||||
|
|
||||||
while repeat < ARGV.size
|
while repeat < ARGV.size
|
||||||
if Valid.url? ARGV[repeat]
|
if Valid.url? ARGV[repeat]
|
||||||
|
begin
|
||||||
response = HTTP::Client.get(ARGV[repeat])
|
response = HTTP::Client.get(ARGV[repeat])
|
||||||
if config.includes?(response.status_code.to_s)
|
if config.includes?(response.status_code.to_s)
|
||||||
puts "#{ARGV[repeat]} is a valid URL and works. Status code: #{response.status_code}"
|
puts "#{ARGV[repeat]} is a valid URL and works. Status code: #{response.status_code}"
|
||||||
@@ -73,12 +74,16 @@ while repeat < ARGV.size
|
|||||||
puts "#{ARGV[repeat]} is a valid URL but does not work. Status Code: #{response.status_code}"
|
puts "#{ARGV[repeat]} is a valid URL but does not work. Status Code: #{response.status_code}"
|
||||||
notWorking += 1
|
notWorking += 1
|
||||||
end
|
end
|
||||||
elsif
|
rescue Socket::Addrinfo::Error
|
||||||
|
puts "#{ARGV[repeat]} is a valid URL but does not exist."
|
||||||
|
notWorking += 1
|
||||||
|
end
|
||||||
|
else
|
||||||
puts "#{ARGV[repeat]} is not a valid URL"
|
puts "#{ARGV[repeat]} is not a valid URL"
|
||||||
notWorking += 1
|
notWorking += 1
|
||||||
end
|
end
|
||||||
repeat += 1
|
repeat += 1
|
||||||
end
|
end
|
||||||
|
|
||||||
puts "=============================="
|
puts "=============================="
|
||||||
puts "Finished testing urls."
|
puts "Finished testing urls."
|
||||||
|
|||||||
Reference in New Issue
Block a user