Follow the white rabbit...

June 1, 2020

Automated domain name idea generation and validation

Soooo I wrote this to generate a list of domain name ideas from permutations of my own word lists and then bulk verify their availability via whois, and then save those results to a file. Use it responsibly. Domain squatting is obnoxious. Anyway, here's Wonderwall...


Step 1: Install dependencies: gem install whois && gem install whois-parser && gem install subexec && npm install startup-name-generator

Step 2: Run the script with quotes on your space delimited word list: ruby domainbrain.rb 'petcare pets grooming walkers dogs cats dogsitter'

Step 3: ...PROFIT!







require 'whois'
require 'whois-parser'
require 'subexec'
return false if ARGV[0].blank?

if ARGV[0].split(" ").empty?
  puts "You must choose a few words to use for idea generation. For instance: 'ruby domain_machine.rb red fish blue dolphin chat mobile app'"
  return false
end

words = ARGV[0].split(" ")
puts ">>> Generating ideas for names using #{words.count} words..."
words = words.join(" ")
cmd = "startup-name-generator #{words}"
dictionary =  Subexec.run cmd
if dictionary
  ideas = dictionary.output
end


if ideas
  puts ideas
  puts ideas.class
  name_array = eval(ideas)

end

if name_array and name_array.empty? == false
  puts "[INFO]: Generated #{name_array.count} ideas for domain names"
else
  puts "NO ideas..."
  return false
end

domains = []
outputs = []
buyme = []
name_array.each do |name|
  name = name.gsub(/[^0-9A-Za-z]/, '').downcase
  if name.chars.count < 15
    domains << "#{name}.com"
  end
end

puts "[INFO]: Checking availablity for #{domains.count} domains..."

domains.each do |domain|
  begin
      record = Whois.whois(domain)
      if record
        parser = record.parser
        if parser and parser.available? == true and parser.registered? == false
          buyme << domain
          puts "+ #{domain}"
        end
      end
  rescue => details
    puts "? #{domain}"
  end
end


unless buyme.empty?
   puts "[INFO]: Found #{buyme} domains"
   terms = words
   saved = File.open("domains_available_for_purchase_related_to_#{terms}.txt", "wb")
   buyme.each do |domain|
    saved << "#{domain}\n"
    puts domain   
   end
   saved.close
end 
Posted in Code