ULTRA FAST EMAIL EXTRACTOR SCRIPT (PYTHON)
This Script Extract Total emails found in any given file with any kind of Mixed Data!
Save below code to extract.py and run python extract.py file-name
SCREENSHOT:
if this helped you! Give me like and React! HF :)
This Script Extract Total emails found in any given file with any kind of Mixed Data!
Save below code to extract.py and run python extract.py file-name
SCREENSHOT:
if this helped you! Give me like and React! HF :)
Python:
import re
import sys
import random
import time
EMAIL_REGEX = re.compile(r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}(?:\.[A-Z|a-z]{2,})?\b')
if len(sys.argv) < 2:
print("==============================================")
print("")
print("ULTRA FAST EMAIL EXTRACTOR FROM ANY RAW FILE")
print("")
print("Usage: python extract.py <input_file>")
print("")
print("==============================================")
sys.exit(1)
input_file = sys.argv[1]
with open(input_file, 'r') as f:
content = f.read()
start_time = time.time()
matches = EMAIL_REGEX.findall(content)
end_time = time.time()
matches.sort(key=len)
num_to_remove = int(len(matches) * 0.025)
matches = matches[num_to_remove:-num_to_remove]
num_rounds = 10
for i in range(num_rounds):
random.shuffle(matches)
with open(input_file, 'w') as f:
f.write('\n'.join(matches))
print(f"Extracted {len(matches)} email addresses in {end_time - start_time:.4f} seconds.")