Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Netflix login is no longer required #1

Merged
merged 1 commit into from
May 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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