Created
November 11, 2008 09:39
-
-
Save bomberstudios/23790 to your computer and use it in GitHub Desktop.
Buscador de dominios .com disponibles
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
# Shell script para buscar dominios disponibles a partir de listas de palabras. | |
# Acepta un fichero como parámetro, y por defecto usa el listado de lemas de | |
# http://olea.org/proyectos/lemarios/ | |
# | |
# Para cambiar el criterio de búsqueda, modifica la condicion de la primera línea | |
# con los parámetros que necesites | |
condicion = lambda{ |i| i.length >= 3 } | |
INPUT_FILE = ARGV[0] || "lemario-espanol-2002-10-25.txt" | |
OUTPUT_FILE = File.basename(INPUT_FILE,".txt") + "-available.html" | |
def cleanup(txt) | |
txt.gsub(/[áÁ\301\341]/,"a").gsub(/[éÉ\351]/,"e").gsub(/[íÍ\355]/,"i").gsub(/[óÓ\363\323]/,"o").gsub(/[úÚ\372\332\374]/,"u").gsub(/[ñÑ\361]/,"n") | |
end | |
input = File.readlines(INPUT_FILE).sort { |a,b| a.length - b.length }.map { |item| item.chomp }.select &condicion | |
f = File.new(OUTPUT_FILE,"w"); | |
f.sync = true | |
input.each do |domain| | |
original = domain | |
domain = cleanup(domain) | |
w = %x(whois -Q #{domain}.com) | |
if w.match(/No match for/) | |
puts "#{domain}.com available" | |
f << "<a href='http://buscon.rae.es/draeI/SrvltConsulta?TIPO_BUS=3&LEMA=#{original}'>#{domain}</a>" + "\n" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment