Browse Source

Integrate changes that allow selecting year

pull/31/head
Wesley Kerfoot 5 years ago
parent
commit
5c11163180
  1. 14
      deletefb/deletefb.py
  2. 2
      deletefb/tools/login.py
  3. 10
      deletefb/tools/wall.py

14
deletefb/deletefb.py

@ -53,6 +53,15 @@ def run_delete():
help="Run browser in headless mode (no gui)"
)
parser.add_argument(
"-Y",
"--year",
required=False,
dest="year",
type=str,
help="The year(s) you want posts deleted."
)
args = parser.parse_args()
args_user_password = args.password or getpass.getpass('Enter your password: ')
@ -60,12 +69,13 @@ def run_delete():
driver = login(
user_email_address=args.email,
user_password=args_user_password,
user_profile_url=args.profile_url,
is_headless=args.is_headless,
two_factor_token=args.two_factor_token
)
wall.delete_posts(driver)
wall.delete_posts(driver,
args.profile_url,
year=args.year)
if __name__ == "__main__":
run_delete()

2
deletefb/tools/login.py

@ -5,7 +5,6 @@ from seleniumrequests import Chrome
def login(user_email_address,
user_password,
user_profile_url,
is_headless,
two_factor_token):
"""
@ -66,5 +65,4 @@ def login(user_email_address,
time.sleep(20)
print("Continuing execution")
driver.get(user_profile_url)
return driver

10
deletefb/tools/wall.py

@ -5,10 +5,18 @@ from .common import SELENIUM_EXCEPTIONS
MAX_POSTS = 5000
def delete_posts(driver):
def delete_posts(driver,
user_profile_url,
year=None):
"""
Deletes or hides all posts from the wall
"""
if not year is None:
user_profile_url = "{0}/timeline?year={1}".format(user_profile_url, year)
driver.get(user_profile_url)
for _ in range(MAX_POSTS):
post_button_sel = "_4xev"

Loading…
Cancel
Save