Sha256: 09cb7610f3a9c8ea8ecc5296266e7f193840136c18d3d866ccb7b497602b87ca

Contents?: true

Size: 836 Bytes

Versions: 37

Compression:

Stored size: 836 Bytes

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require_relative "helpers"

puts "=> Fetching tld list"
tlds = http_request(:get, "https://data.iana.org/TLD/tlds-alpha-by-domain.txt").body.lines
tlds.shift # remove update notice

tlds = tlds
       .map(&:downcase)
       .map(&:strip)
       .map {|tld| SimpleIDN.to_ascii(tld) }

puts "=> Saving tlds.txt"
save_file("tlds.txt", normalize_list(tlds))

puts "=> Fetching country tld list"
country_tlds = JSON.parse(
  http_request(:get, "https://github.com/samayo/country-json/raw/master/src/country-by-domain-tld.json").body,
  symbolize_names: true
)
country_tlds = country_tlds
               .reject {|info| info[:tld].nil? }
               .map {|info| info[:tld].gsub(/^\./, "") }

puts "=> Saving country_tlds.txt"
save_file("country_tlds.txt", normalize_list(country_tlds))

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
email_data-1605293459 bin/sync-tld
email_data-1605067682 bin/sync-tld
email_data-1604944785 bin/sync-tld
email_data-1604907377 bin/sync-tld
email_data-1604799858 bin/sync-tld
email_data-1604735754 bin/sync-tld
email_data-1604703468 bin/sync-tld
email_data-1604569392 bin/sync-tld
email_data-1604444717 bin/sync-tld
email_data-1604325875 bin/sync-tld
email_data-1604239223 bin/sync-tld
email_data-1604097095 bin/sync-tld
email_data-1604010434 bin/sync-tld
email_data-1603923660 bin/sync-tld
email_data-1603817241 bin/sync-tld
email_data-1603707709 bin/sync-tld
email_data-1603621117 bin/sync-tld
email_data-1603499092 bin/sync-tld
email_data-1603398147 bin/sync-tld
email_data-1603311369 bin/sync-tld