Created
June 4, 2012 01:56
-
-
Save tlehman/2865871 to your computer and use it in GitHub Desktop.
List all available three-character .io domain names (depends on colorize)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
require 'colorize' | |
# find all available three-letter .io domains | |
alph = ('a'..'z') | |
# generate all three-character strings | |
threes = alph.map { |a| alph.map { |b| alph.map { |c| "#{a}#{b}#{c}" } } }.flatten | |
def io_available?(tld) | |
url = URI.parse("http://www.nic.io/cgi-bin/whois?query=#{tld}.io") | |
html = Net::HTTP.get(url) | |
if html =~ /Domain Available/ | |
return true | |
else | |
return false | |
end | |
end | |
avail_threes = [] | |
# output which are available and which are not | |
threes.each do |t| | |
if io_available? t | |
avail_threes << t | |
puts "#{t}.io".green | |
else | |
puts "#{t}.io".red | |
end | |
end | |
# store available ones in a file | |
File.open('avail_threes.txt', 'w') do |f| | |
avail_threes.each do |a| | |
f.write("#{a}.io\n") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This needs to be broken up into 26 smaller searches (one per letter), and some delay needs to be added, because nic.io appears to time out after enough consecutive requests.