Basically, I needed to check the age of the domain. When you copy any URL, it should get converted from http://www.google.com/xyz to google.com
Then I can tell Keyboard Maestro to launch Terminal, type in whois %CurrentClipboard% pause a sec, CMD+F, and search for “Creation Date” to get the domain age quickly.
PS: There’s no reliable good Google Chrome Extension for checking domain age.
I’m struggling to convert URL to root domain. Maybe via regex search and replace clipboard?
Got a regex - (\w+)\.(com|net|gov|edu|co) to match the root domain. Not sure how to proceed.
Maybe anyone has even more elegant way to find the domain age perhaps in format like 1 Years, 45 days old as opposed to mm-dd-yyyy format which is easy on my eyes?
It will not work with subdomains other than "www" like in "files.google.com/xyz". To make a regex work with all kind of URLs it seems you need a complete list of TLDs (because of TLDs like "co.uk"). See also this post on Stackoverflow.
####DOWNLOAD:
<a class="attachment" href="/uploads/default/original/2X/2/2837417161ccf5c0db822e7a9ed602419a281562.kmmacros">@RegEx Extract Domain Name [Example].kmmacros</a> (3.3 KB)
**Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.**
---
<img src="/uploads/default/original/2X/1/1b012163fa9c81df2bf4e913d944c9452902bf34.png" width="459" height="873">
#!/usr/bin/env perl
use 5.010;
use strict;
use warnings;
use Domain::PublicSuffix;
my $suffix = Domain::PublicSuffix->new({'data_file' => '/tmp/effective_tld_names.dat'});
my $root = $suffix->get_root_domain('server1.db.de');
# my $root = $suffix->get_root_domain('db.de');
# my $root = $suffix->get_root_domain('server1.db.co.uk');
print $root;
How do we get/install this module?
I read the cpan.org article, but it says:
This module will attempt to search etc directories in /usr/share/publicsuffix, /usr, /usr/local, and /opt/local for the effective_tld_names.dat file. If a file is not found, a default file is loaded from Domain::PublicSuffix::Default, which is current at the time of the module's release. You can override the data file path by giving the new() method a 'data_file' argument.
OK, I installed both in the order you said: brew install perl brew install cpanm
but when I run from a KM Execute Shell Script, I get this:
Can't locate Domain/PublicSuffix.pm in @INC (you may need to install the Domain::PublicSuffix module) (@INC contains: /Library/Perl/5.18/darwin-thread-multi-2level /Library/Perl/5.18 /Network/Library/Perl/5.18/darwin-thread-multi-2level /Network/Library/Perl/5.18 /Library/Perl/Updates/5.18.2 /System/Library/Perl/5.18/darwin-thread-multi-2level /System/Library/Perl/5.18 /System/Library/Perl/Extras/5.18/darwin-thread-multi-2level /System/Library/Perl/Extras/5.18 .) at /var/folders/hb/6xgg0y8j4g530m81rd1f9mpc0000gn/T/Keyboard-Maestro-Script-51EF52D5-FB9D-48E7-B9B0-BF516C979CFF line 7.
BEGIN failed--compilation aborted at /var/folders/hb/6xgg0y8j4g530m81rd1f9mpc0000gn/T/Keyboard-Maestro-Script-51EF52D5-FB9D-48E7-B9B0-BF516C979CFF line 7.
I'm a total shell script dummy, so I don't have idea what this means, except that it could not find the Domain/PublicSuffix.pm
/Users/Shared/Dropbox/SW/DEV/Projects/[KM] Extract Domain Name/Get-Domain.pl:7: Can't locate Domain/PublicSuffix.pm in @INC (you may need to install the Domain::PublicSuffix module) (@INC contains: /usr/local/Cellar/perl/5.26.0/lib/perl5/site_perl/5.26.0/darwin-thread-multi-2level /usr/local/Cellar/perl/5.26.0/lib/perl5/site_perl/5.26.0 /usr/local/Cellar/perl/5.26.0/lib/perl5/5.26.0/darwin-thread-multi-2level /usr/local/Cellar/perl/5.26.0/lib/perl5/5.26.0 /usr/local/lib/perl5/site_perl/5.26.0)
To install "Domain::PublicSuffix module", do I need to do it from any particular dir?
Last time I did it from my home dir.