|
@ -1,10 +1,12 @@ |
|
|
#! /usr/bin/env python |
|
|
#! /usr/bin/env python |
|
|
|
|
|
|
|
|
|
|
|
import argparse |
|
|
|
|
|
import time |
|
|
|
|
|
|
|
|
from seleniumrequests import Chrome |
|
|
from seleniumrequests import Chrome |
|
|
from selenium.webdriver.common.action_chains import ActionChains |
|
|
from selenium.webdriver.common.action_chains import ActionChains |
|
|
from selenium.webdriver.chrome.options import Options |
|
|
from selenium.webdriver.chrome.options import Options |
|
|
import time |
|
|
|
|
|
import argparse |
|
|
|
|
|
|
|
|
|
|
|
MAX_POSTS = 5000 |
|
|
MAX_POSTS = 5000 |
|
|
|
|
|
|
|
@ -60,18 +62,13 @@ def delete_posts(user_email_address, |
|
|
user_profile_url, |
|
|
user_profile_url, |
|
|
is_headless): |
|
|
is_headless): |
|
|
""" |
|
|
""" |
|
|
user_email_address: Your Email |
|
|
user_email_address: str Your Email |
|
|
user_password: Your password |
|
|
user_password: str Your password |
|
|
user_profile_url: Your profile URL |
|
|
user_profile_url: str Your profile URL |
|
|
""" |
|
|
""" |
|
|
|
|
|
|
|
|
assert all((user_email_address, |
|
|
|
|
|
user_password, |
|
|
|
|
|
user_profile_url)), "Insufficient arguments provided" |
|
|
|
|
|
|
|
|
|
|
|
# The Chrome driver is required because Gecko was having issues |
|
|
# The Chrome driver is required because Gecko was having issues |
|
|
chrome_options = Options() |
|
|
chrome_options = Options() |
|
|
prefs = {"profile.default_content_setting_values.notifications" : 2} |
|
|
prefs = {"profile.default_content_setting_values.notifications": 2, 'disk-cache-size': 4096} |
|
|
chrome_options.add_experimental_option("prefs", prefs) |
|
|
chrome_options.add_experimental_option("prefs", prefs) |
|
|
chrome_options.add_argument("start-maximized") |
|
|
chrome_options.add_argument("start-maximized") |
|
|
|
|
|
|
|
@ -87,19 +84,17 @@ def delete_posts(user_email_address, |
|
|
|
|
|
|
|
|
email = "email" |
|
|
email = "email" |
|
|
password = "pass" |
|
|
password = "pass" |
|
|
login="loginbutton" |
|
|
login = "loginbutton" |
|
|
|
|
|
|
|
|
emailelement = driver.find_element_by_name(email) |
|
|
emailelement = driver.find_element_by_name(email) |
|
|
|
|
|
|
|
|
passwordelement = driver.find_element_by_name(password) |
|
|
passwordelement = driver.find_element_by_name(password) |
|
|
|
|
|
|
|
|
emailelement.send_keys(user_email_address) |
|
|
emailelement.send_keys(user_email_address) |
|
|
|
|
|
|
|
|
passwordelement.send_keys(user_password) |
|
|
passwordelement.send_keys(user_password) |
|
|
|
|
|
|
|
|
loginelement = driver.find_element_by_id(login) |
|
|
loginelement = driver.find_element_by_id(login) |
|
|
|
|
|
|
|
|
loginelement.click() |
|
|
loginelement.click() |
|
|
|
|
|
|
|
|
if "Two-factor authentication" in driver.page_source: |
|
|
if "Two-factor authentication" in driver.page_source: |
|
|
# Allow time to enter 2FA code |
|
|
# Allow time to enter 2FA code |
|
|
print("Pausing to enter 2FA code") |
|
|
print("Pausing to enter 2FA code") |
|
@ -133,3 +128,7 @@ def delete_posts(user_email_address, |
|
|
# Required to sleep the thread for a bit after using JS to click this button |
|
|
# Required to sleep the thread for a bit after using JS to click this button |
|
|
time.sleep(5) |
|
|
time.sleep(5) |
|
|
driver.refresh() |
|
|
driver.refresh() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__": |
|
|
|
|
|
run_delete() |
|
|