Skip to content

Commit

Permalink
Added support for all DonutsInc TLDs (241 at the time: .ACADEMY, .ACC…
Browse files Browse the repository at this point in the history
…OUNTANTS, .ACTOR, .AGENCY, .AIRFORCE, .APARTMENTS, .ARMY, .ASSOCIATES, .ATTORNEY, .AUCTION, .BAND, .BARGAINS, .BIKE, .BINGO, .BOUTIQUE, .BUILDERS, .BUSINESS, .CAB, .CAFE, .CAMERA, .CAMP, .CAPITAL, .CARDS, .CARE, .CAREERS, .CASH, .CASINO, .CATERING, .CENTER, .CHARITY, .CHAT, .CHEAP, .CHURCH, .CITY, .CLAIMS, .CLEANING, .CLINIC, .CLOTHING, .COACH, .CODES, .COFFEE, .COMMUNITY, .COMPANY, .COMPUTER, .CONDOS, .CONSTRUCTION, .CONTACT, .CONTRACTORS, .COOL, .COUPONS, .CREDIT, .CREDITCARD, .CRUISES, .DANCE, .DATING, .DEALS, .DEGREE, .DELIVERY, .DEMOCRAT, .DENTAL, .DENTIST, .DIAMONDS, .DIGITAL, .DIRECT, .DIRECTORY, .DISCOUNT, .DOCTOR, .DOG, .DOMAINS, .EDUCATION, .EMAIL, .ENERGY, .ENGINEER, .ENGINEERING, .ENTERPRISES, .EQUIPMENT, .ESTATE, .EVENTS, .EXCHANGE, .EXPERT, .EXPOSED, .EXPRESS, .FAIL, .FAMILY, .FAN, .FARM, .FINANCE, .FINANCIAL, .FISH, .FITNESS, .FLIGHTS, .FLORIST, .FOOTBALL, .FORSALE, .FOUNDATION, .FUND, .FURNITURE, .FUTBOL, .FYI, .GALLERY, .GAMES, .GIFTS, .GIVES, .GLASS, .GMBH, .GOLD, .GOLF, .GRAPHICS, .GRATIS, .GRIPE, .GROUP, .GUIDE, .GURU, .HAUS, .HEALTHCARE, .HOCKEY, .HOLDINGS, .HOLIDAY, .HOSPITAL, .HOUSE, .IMMO, .IMMOBILIEN, .INDUSTRIES, .INSTITUTE, .INSURE, .INTERNATIONAL, .INVESTMENTS, .IRISH, .JETZT, .JEWELRY, .KAUFEN, .KITCHEN, .LAND, .LAWYER, .LEASE, .LEGAL, .LIFE, .LIGHTING, .LIMITED, .LIMO, .LIVE, .LOANS, .LTD, .MAISON, .MANAGEMENT, .MARKET, .MARKETING, .MBA, .MEDIA, .MEMORIAL, .MODA, .MONEY, .MORTGAGE, .MOVIE, .NAVY, .NETWORK, .NEWS, .NINJA, .PARTNERS, .PARTS, .PHOTOGRAPHY, .PHOTOS, .PICTURES, .PIZZA, .PLACE, .PLUMBING, .PLUS, .PRODUCTIONS, .PROPERTIES, .PUB, .RECIPES, .REHAB, .REISE, .REISEN, .RENTALS, .REPAIR, .REPORT, .REPUBLICAN, .RESTAURANT, .REVIEWS, .RIP, .ROCKS, .RUN, .SALE, .SALON, .SARL, .SCHOOL, .SCHULE, .SERVICES, .SHOES, .SHOPPING, .SHOW, .SINGLES, .SOCCER, .SOCIAL, .SOFTWARE, .SOLAR, .SOLUTIONS, .STUDIO, .STYLE, .SUPPLIES, .SUPPLY, .SUPPORT, .SURGERY, .SYSTEMS, .TAX, .TAXI, .TEAM, .TECHNOLOGY, .TENNIS, .THEATER, .TIENDA, .TIPS, .TIRES, .TODAY, .TOOLS, .TOURS, .TOWN, .TOYS, .TRAINING, .TRAVEL, .UNIVERSITY, .VACATIONS, .VENTURES, .VET, .VIAJES, .VIDEO, .VILLAS, .VIN, .VISION, .VOYAGE, .WATCH, .WINE, .WORKS, .WORLD, .WTF, .ZONE, .企业, .娱乐, .游戏, .商店) + support for body guessing of the parser + refactor specs to be shorter and quicker
  • Loading branch information
jarthod committed Dec 7, 2021
1 parent ed7068c commit 6354c4e
Show file tree
Hide file tree
Showing 793 changed files with 20,245 additions and 44,543 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ This project uses [Semantic Versioning 2.0.0](http://semver.org/).

#### master

- NEW: Added support for all DonutsInc TLDs (241 at the time: .ACADEMY, .ACCOUNTANTS, .ACTOR, .AGENCY, .AIRFORCE, .APARTMENTS, .ARMY, .ASSOCIATES, .ATTORNEY, .AUCTION, .BAND, .BARGAINS, .BIKE, .BINGO, .BOUTIQUE, .BUILDERS, .BUSINESS, .CAB, .CAFE, .CAMERA, .CAMP, .CAPITAL, .CARDS, .CARE, .CAREERS, .CASH, .CASINO, .CATERING, .CENTER, .CHARITY, .CHAT, .CHEAP, .CHURCH, .CITY, .CLAIMS, .CLEANING, .CLINIC, .CLOTHING, .COACH, .CODES, .COFFEE, .COMMUNITY, .COMPANY, .COMPUTER, .CONDOS, .CONSTRUCTION, .CONTACT, .CONTRACTORS, .COOL, .COUPONS, .CREDIT, .CREDITCARD, .CRUISES, .DANCE, .DATING, .DEALS, .DEGREE, .DELIVERY, .DEMOCRAT, .DENTAL, .DENTIST, .DIAMONDS, .DIGITAL, .DIRECT, .DIRECTORY, .DISCOUNT, .DOCTOR, .DOG, .DOMAINS, .EDUCATION, .EMAIL, .ENERGY, .ENGINEER, .ENGINEERING, .ENTERPRISES, .EQUIPMENT, .ESTATE, .EVENTS, .EXCHANGE, .EXPERT, .EXPOSED, .EXPRESS, .FAIL, .FAMILY, .FAN, .FARM, .FINANCE, .FINANCIAL, .FISH, .FITNESS, .FLIGHTS, .FLORIST, .FOOTBALL, .FORSALE, .FOUNDATION, .FUND, .FURNITURE, .FUTBOL, .FYI, .GALLERY, .GAMES, .GIFTS, .GIVES, .GLASS, .GMBH, .GOLD, .GOLF, .GRAPHICS, .GRATIS, .GRIPE, .GROUP, .GUIDE, .GURU, .HAUS, .HEALTHCARE, .HOCKEY, .HOLDINGS, .HOLIDAY, .HOSPITAL, .HOUSE, .IMMO, .IMMOBILIEN, .INDUSTRIES, .INSTITUTE, .INSURE, .INTERNATIONAL, .INVESTMENTS, .IRISH, .JETZT, .JEWELRY, .KAUFEN, .KITCHEN, .LAND, .LAWYER, .LEASE, .LEGAL, .LIFE, .LIGHTING, .LIMITED, .LIMO, .LIVE, .LOANS, .LTD, .MAISON, .MANAGEMENT, .MARKET, .MARKETING, .MBA, .MEDIA, .MEMORIAL, .MODA, .MONEY, .MORTGAGE, .MOVIE, .NAVY, .NETWORK, .NEWS, .NINJA, .PARTNERS, .PARTS, .PHOTOGRAPHY, .PHOTOS, .PICTURES, .PIZZA, .PLACE, .PLUMBING, .PLUS, .PRODUCTIONS, .PROPERTIES, .PUB, .RECIPES, .REHAB, .REISE, .REISEN, .RENTALS, .REPAIR, .REPORT, .REPUBLICAN, .RESTAURANT, .REVIEWS, .RIP, .ROCKS, .RUN, .SALE, .SALON, .SARL, .SCHOOL, .SCHULE, .SERVICES, .SHOES, .SHOPPING, .SHOW, .SINGLES, .SOCCER, .SOCIAL, .SOFTWARE, .SOLAR, .SOLUTIONS, .STUDIO, .STYLE, .SUPPLIES, .SUPPLY, .SUPPORT, .SURGERY, .SYSTEMS, .TAX, .TAXI, .TEAM, .TECHNOLOGY, .TENNIS, .THEATER, .TIENDA, .TIPS, .TIRES, .TODAY, .TOOLS, .TOURS, .TOWN, .TOYS, .TRAINING, .TRAVEL, .UNIVERSITY, .VACATIONS, .VENTURES, .VET, .VIAJES, .VIDEO, .VILLAS, .VIN, .VISION, .VOYAGE, .WATCH, .WINE, .WORKS, .WORLD, .WTF, .ZONE, .企业, .娱乐, .游戏, .商店)
- FIX: Updated parser for .CA tld
- NEW: Added parser for .WORLD tld
- NEW: Add whois.nic.google (support for .APP, .DEV, .HOW, .PAGE, .SOY) and update xn--q9jyb4c (.みんな) to use whois.nic.google (based on #124) Thanks @derekjc
Expand Down
39 changes: 22 additions & 17 deletions lib/whois/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,8 @@ def self.bug!(error, message)
PROPERTY_STATE_SUPPORTED = :supported


# Returns the proper parser instance for given <tt>part</tt>.
# The parser class is selected according to the
# value of the <tt>#host</tt> attribute for given <tt>part</tt>.
# Instanciate the proper parser instance for given <tt>part</tt>.
# The parser class is determined using <tt>.parser_for</tt>
#
# @param [Whois::Record::Part] part The part to get the parser for.
#
Expand All @@ -112,37 +111,41 @@ def self.bug!(error, message)
# # => #<Whois::Parsers::Blank>
#
def self.parser_for(part)
parser_klass(part.host).new(part)
rescue LoadError
Parsers.const_defined?("Blank") || autoload("blank")
Parsers::Blank.new(part)
parser_klass(part).new(part)
end

# Detects the proper parser class according to given <tt>host</tt>
# Detects the proper parser class according to given <tt>part</tt>
# and returns the class constant.
# The parser class is selected according to the values of the
# <tt>#host</tt> and <tt>#body</tt> attributes for given <tt>part</tt>.
#
# This method autoloads missing parser classes. If you want to define
# a custom parser, simple make sure the class is loaded in the Ruby
# environment before this method is called.
#
# @param [String] host The server host.
# @param [Whois::Record::Part] part The part to get the parser for.
#
# @return [Class] The instance of Class representing the parser Class
# corresponding to <tt>host</tt>. If <tt>host</tt> doesn't have
# corresponding to <tt>part</tt>. If <tt>part</tt> doesn't have
# a specific parser implementation, then returns
# the {Whois::Parsers::Blank} {Class}.
# The {Class} is expected to be a child of {Whois::Parsers::Base}.
# @raises LoadError If the class is not found.
#
# @example
#
# Parser.parser_klass("whois.example.com")
# Parser.parser_klass(Whois::Record::Part.new(host: "whois.example.com"))
# # => Whois::Parsers::WhoisExampleCom
#
def self.parser_klass(host)
name = host_to_parser(host)
Parsers.const_defined?(name) || autoload(host)
Parsers.const_get(name)
def self.parser_klass(part)
autoload(part.host)
rescue LoadError
# Some WHOIS services like Donuts Inc covers hundred of TLDs (https://donuts.domains/what-we-do/top-level-domain-portfolio/)
# But using one host per TLD, so in this case it's easier to match on the disclaimer directly to cover all hosts
if part.body&.include?("Terms of Use: Donuts Inc.")
autoload("donuts_inc")
else
autoload("blank")
end
end

# Converts <tt>host</tt> to the corresponding parser class name.
Expand Down Expand Up @@ -172,7 +175,9 @@ def self.host_to_parser(host)
# @return [void]
#
def self.autoload(name)
require "whois/parsers/#{name}"
class_name = host_to_parser(name)
require_relative "parsers/#{name}" unless Parsers.const_defined?(class_name)
Parsers.const_get(class_name)
end


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ class Parsers
# @see Whois::Parsers::Example
# The Example parser for the list of all available methods.
#
class WhoisDonutsCo < BaseIcannCompliant
class DonutsInc < BaseIcannCompliant

self.scanner = Scanners::BaseIcannCompliant, {
pattern_available: /^Domain not found\./
pattern_available: /^Domain not found\./,
pattern_reserved: /^The registration of this domain is restricted/
}

end
Expand Down
25 changes: 0 additions & 25 deletions lib/whois/parsers/whois.nic.travel.rb

This file was deleted.

28 changes: 0 additions & 28 deletions lib/whois/parsers/whois.nic.world.rb

This file was deleted.

This file was deleted.

This file was deleted.

63 changes: 0 additions & 63 deletions spec/fixtures/responses/whois.donuts.co/bike/status_registered.txt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Domain not found.

Terms of Use: Donuts Inc. provides this Whois service for information purposes, and to assist persons in obtaining information about or related to a domain name registration record. Donuts does not guarantee its accuracy. Users accessing the Donuts Whois service agree to use the data only for lawful purposes, and under no circumstances may this data be used to: a) allow, enable, or otherwise support the transmission by e-mail, telephone, or facsimile of mass unsolicited, commercial advertising or solicitations to entities other than the registrar's own existing customers and b) enable high volume, automated, electronic processes that send queries or data to the systems of Donuts or any ICANN-accredited registrar, except as reasonably necessary to register domain names or modify existing registrations. When using the Donuts Whois service, please consider the following: The Whois service is not a replacement for standard EPP commands to the SRS service. Whois is not considered authoritative for registered domain objects. The Whois service may be scheduled for downtime during production or OT&E maintenance periods. Queries to the Whois services are throttled. If too many queries are received from a single IP address within a specified time, the service will begin to reject further queries for a period of time to prevent disruption of Whois service access. Abuse of the Whois system through data mining is mitigated by detecting and limiting bulk query access from single sources. Where applicable, the presence of a [Non-Public Data] tag indicates that such data is not made publicly available due to applicable data privacy laws or requirements. Should you wish to contact the registrant, please refer to the Whois records available through the registrar URL listed above. Access to non-public data may be provided, upon request, where it can be reasonably confirmed that the requester holds a specific legitimate interest and a proper legal basis for accessing the withheld data
. Access to this data can be requested by submitting a request via the form found at https://donuts.domains/about/policies/whois-layered-access/ Donuts Inc. reserves the right to modify these terms at any time. By submitting this query, you agree to abide by this policy.
Loading

0 comments on commit 6354c4e

Please sign in to comment.