Adding uniq_domains

pull/130/head
Fafner [_KeyZee_] 2020-11-24 16:44:43 +01:00 committed by GitHub
parent a117a91341
commit 2ae7d87420
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -29,6 +29,7 @@ except ImportError:
from .exceptions import MissingEnv, CreateDirectoryException, ConfigError
from urllib.parse import urlparse
configs: Dict[str, Dict[str, Any]] = {}
logger = logging.getLogger('Lookyloo - Helpers')
@ -313,3 +314,10 @@ def remove_pickle_tree(capture_dir: Path) -> None:
pickle_file = capture_dir / 'tree.pickle'
if pickle_file.exists():
pickle_file.unlink()
def uniq_domains(uniq_urls):
domains = set()
for url in uniq_urls:
splitted = urlparse(url)
domains.add(splitted.hostname)
return domains