-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
29 lines (19 loc) · 798 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import sys
import crawler
import contact_info_finder
if len(sys.argv) < 4:
print(f"Usage: {sys.argv[0]} [url] [download directory] [crawl depth]")
print(f"Example: {sys.argv[0]} https://absolute-metrology.com/ dumps/ams 4")
exit(-1)
url = sys.argv[1]
dir = sys.argv[2]
crawl_depth = int(sys.argv[3])
if "www" in url:
front_trimmed_url = url[url.find("://www.") + 7:]
else:
front_trimmed_url = url[url.find("://") + 3:]
company_name = front_trimmed_url[:front_trimmed_url.find(".")]
print(f"|{company_name}|")
crawler.crawl_and_save(url, crawl_depth, dir)
contact_info_finder.find_in_all_files(dir, contact_info_finder.find_phone_numbers, None)
contact_info_finder.find_in_all_files(dir, contact_info_finder.find_email_addrs, company_name)