Skip to content

Commit

Permalink
Netflix login is no longer required
Browse files Browse the repository at this point in the history
  • Loading branch information
Kampfader authored May 29, 2024
1 parent f0cf435 commit 8e4ff28
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException

NETFLIX_LOGIN = os.environ['NETFLIX_LOGIN']
NETFLIX_PASSWORD = os.environ['NETFLIX_PASSWORD']
EMAIL_IMAP = os.environ['EMAIL_IMAP']
EMAIL_LOGIN = os.environ['EMAIL_LOGIN']
EMAIL_PASSWORD = os.environ['EMAIL_PASSWORD']
Expand All @@ -27,7 +25,7 @@ def extract_links(text):


def open_link_with_selenium(body):
"""Opens Selenium, logins to Netflix and click a button to confirm connection"""
"""Opens Selenium and clicks a button to confirm connection"""
links = extract_links(body)
for link in links:
if "update-primary-location" in link:
Expand All @@ -39,14 +37,8 @@ def open_link_with_selenium(body):
)

driver.get(link)
time.sleep(2)
email_field = driver.find_element('name', 'userLoginId')
email_field.send_keys(NETFLIX_LOGIN)
password_field = driver.find_element('name', 'password')
password_field.send_keys(NETFLIX_PASSWORD)

password_field.send_keys(Keys.RETURN)
time.sleep(2)
time.sleep(3)

try:
element = WebDriverWait(driver, 10).until(
EC.element_to_be_clickable((
Expand All @@ -58,7 +50,7 @@ def open_link_with_selenium(body):
except TimeoutException as exception:
print("Error:", exception)

time.sleep(2)
time.sleep(3)
driver.quit()


Expand Down

0 comments on commit 8e4ff28

Please sign in to comment.