-
Notifications
You must be signed in to change notification settings - Fork 0
/
getemail-fanpage.py
49 lines (36 loc) · 1.29 KB
/
getemail-fanpage.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import requests, json
import time
import argparse
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
import re
def main():
# Chrome driver options
chrome_options = webdriver.ChromeOptions()
chrome_options.add_experimental_option("prefs", { \
"profile.default_content_setting_values.notifications": 1
})
chrome_options.add_argument("--disable-infobars")
chrome_options.add_argument("--disable-extensions")
chrome_options.add_argument("start-maximized")
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--headless')
chrome_options.add_argument('--disable-dev-shm-usage') # for interface progressing
# Prepare driver
driver = webdriver.Chrome(ChromeDriverManager().install(), chrome_options=chrome_options)
try:
# get url facebook from database
url = 'https://www.facebook.com/PlatinumBrian'
driver.get(url)
time.sleep(5)
source = driver.page_source
match = re.search(r'[\w.+-]+@[\w-]+\.[\w.-]+', source)
if match is None:
exit()
email = match.group(0)
print(">>>>>>", email)
#save email to database
except:
print("An exception occurred")
if __name__ == "__main__":
main()