add script for importing domains from quackit
This commit is contained in:
parent
df0ec20ac6
commit
317ea1413f
1
Gemfile
1
Gemfile
@ -3,6 +3,7 @@ source "http://rubygems.org"
|
||||
gem 'public_suffix'
|
||||
|
||||
group :development do
|
||||
gem "nokogiri", "~> 1.5"
|
||||
gem "rake", "~> 10.0"
|
||||
gem "rdoc", "~> 3.12"
|
||||
gem "bundler", "~> 1.5"
|
||||
|
||||
28
Rakefile
28
Rakefile
@ -61,4 +61,30 @@ task :add, :sld, :tld, :name do |t, args|
|
||||
puts "commit failed"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
task :quackit_import do
|
||||
require 'nokogiri'
|
||||
require 'open-uri'
|
||||
require_relative File.join('lib', 'swot', 'academic_tlds')
|
||||
|
||||
domains = Set.new
|
||||
doc = Nokogiri::HTML(open('http://www.quackit.com/domain-names/country_domain_extensions.cfm'))
|
||||
doc.css('#content li').each do |li|
|
||||
desc = li.content.split(' - ')[1]
|
||||
if desc =~ /academic|education|school/i
|
||||
domain_el = li.at_css('b')
|
||||
domain = domain_el.content.sub(/\A\./, '')
|
||||
if domain =~ /\A(\w+\.)*\w+\z/ && !Swot::ACADEMIC_TLDS.include?(domain)
|
||||
puts "#{domain} - #{desc.strip.gsub(/\s+/, ' ')}"
|
||||
domains << domain
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
puts "\nNEW DOMAINS:\n\n"
|
||||
|
||||
domains.sort.each do |domain|
|
||||
puts domain
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user