contact-scan/app.py

28 lines
687 B
Python

import sys
from lib.scanner import Scanner
if len(sys.argv) != 3:
print("Incorrect number of arguments supplied. Usage:")
print("python3 app.py URL_FILE KEYWORD_FILE")
sys.exit(0)
# Get filenames
url_filename = sys.argv[1]
keyword_filename = sys.argv[2]
# Open the url file and get the list of URLs
url_file = open(url_filename, 'r')
urls = url_file.read().split('\n')
# Replace spaces
for url in urls:
url = url.replace(" ", "")
# Open the keyword file and get the list of keywords
keyword_file = open(keyword_filename, 'r')
keywords = keyword_file.read().split('\n')
# Scan the contacts in the URL
contact_scanner = Scanner(urls, keywords)
contact_scanner.get_contacts()