-
Notifications
You must be signed in to change notification settings - Fork 0
/
facebook.py
28 lines (25 loc) · 1.05 KB
/
facebook.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
from selenium import webdriver
from common import *
from selenium.webdriver.chrome.options import Options
from time import sleep
def scrape_facebook_page():
options = Options()
options.add_argument("--disable-notifications")
driver = webdriver.Chrome(chrome_options=options)
driver.set_window_size(1640, 1640)
driver.maximize_window()
driver.get("https://facebook.com")
email = os.environ['EMAIL']
password = os.environ['PASSWORD']
driver.find_element_by_css_selector('input[name="email"]').send_keys(email)
driver.find_element_by_css_selector('input[data-testid="royal_pass"]').send_keys(password)
driver.find_element_by_css_selector('input[data-testid="royal_pass"]').submit()
sleep(2)
driver.find_element_by_xpath('//*[text()="Hackathon Hackers"]').click()
scroll_few_pages(driver, pages=100)
hack_data = driver.find_elements_by_css_selector('.userContent p')
for data in hack_data:
print(data.get_attribute('innerHTML'))
driver.quit()
if __name__ == '__main__':
scrape_facebook_page()