Public Suffix for MySql
Mysql's functions to parse domain names based on the Public Suffix List.
Installation
$ git clone https://github.com/rvflash/publicsuffix-sqlTesting
Go into the source directory and starts the Docker.
$ cd publicsuffix-sql
$ docker-compose up
$ docker exec -ti $(docker ps -lq) bashIn the new prompt, opens the MySql client:
$ mysql -h db -u root -ps3cr3tp4ssw0rd psFeatures
- The function named
hostnameextracts the hostname in a URL. - Function named
domainreturns the hostname without the sub-domain (ex: google.com.au). - The
sldandtldfunctions returns respectively the second level domain (ex: com.au) and top level domain (ex: au).
> select hostname("https://www.google.com.au/search?q=golang");
+-------------------------------------------------------+
| hostname("https://www.google.com.au/search?q=golang") |
+-------------------------------------------------------+
| www.google.com.au |
+-------------------------------------------------------+
1 row in set (0.00 sec)
> select domain("https://www.google.com.au/");
+--------------------------------------+
| domain("https://www.google.com.au/") |
+--------------------------------------+
| google.com.au |
+--------------------------------------+
1 row in set (0.00 sec)
> select sld(domain("https://www.google.com.au/"));
+-------------------------------------------+
| sld(domain("https://www.google.com.au/")) |
+-------------------------------------------+
| com.au |
+-------------------------------------------+
1 row in set (0.00 sec)

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.
