This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def parse(domain, psl): | |
fuzzy_hosts = ('www', 'mobile', 'm') | |
domain_parts = domain.split('.') | |
if domain_parts[0] in fuzzy_hosts: | |
domain_parts = domain_parts[1:] | |
if '.'.join(domain_parts[1:]) in psl: | |
return sorted(['.'.join(domain_parts)] + \ | |
['.'.join([fuzzy_host] + domain_parts) for fuzzy_host in fuzzy_hosts]) | |
else: | |
return sorted([domain]) |
NewerOlder