diff --git a/README.md b/README.md index 0da68a1..a9d52e7 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ This script will download the Tesla Service Manual onto a local doc folder for o 1. Go into `secrets.py` and fill out `tesla_account_email` and `tesla_account_password` with your account and password. 2. Go into `scrape.py` and enter the index URL of the manual you want saved by changing `service_manual_index` and `base_url` variables. It is defaulted to the Model 3. -3. If you have 2FA or other challenges with login, consider changing `login_delay` to 2 or 3 seconds so you can manually enter your credentials. +3. If you have 2FA or other challenges with login, consider changing `login_delay` in `secrets.py` to 2 or 3 seconds so you can manually enter your credentials. 4. Setup Python 3. See tutorial at: 5. Setup selenium for Python. To use the required stealth module, you **must** use the Chromium webdriver. See tutorial at: 6. Pip install the required packages (including `requests`, `selenium`, `selenium-stealth`, and `beautifulsoup4`). On windows, you run the following commands on command prompt (CMD): diff --git a/scrape.py b/scrape.py index f68128e..967a08f 100644 --- a/scrape.py +++ b/scrape.py @@ -12,7 +12,7 @@ from secrets import tesla_login # Step 0: Indicate which manual you plan to scrape, currently set to Model 3. Also increase the login delay to give yourself time to login if you have 2FA or encounter other login issues. service_manual_index = "https://service.tesla.com/docs/Model3/ServiceManual/en-us/index.html" base_url = "https://service.tesla.com/docs/Model3/ServiceManual/en-us/" -login_delay = 0 + # Step 1: Set up the webdriver @@ -34,9 +34,7 @@ stealth(driver, ) # Step 2: Login to Tesla -time.sleep(login_delay) driver = tesla_login(driver) -time.sleep(login_delay) # Step 3: Get to the index page driver.get(service_manual_index) diff --git a/secrets.py b/secrets.py index d357608..c962c53 100644 --- a/secrets.py +++ b/secrets.py @@ -3,15 +3,16 @@ import time # Step 0: Input your tesla account details tesla_account_email = "YOUR TESLA EMAIL HERE" tesla_account_password = "YOUR TESLA PASSWORD HERE" +login_delay = 0 def tesla_login(driver): driver.get("https://tesla.com/teslaaccount") driver.find_element_by_css_selector("#form-input-identity").send_keys(tesla_account_email) - time.sleep(2) + time.sleep(2 + login_delay) driver.find_element_by_css_selector("#form-submit-continue").click() - time.sleep(2) + time.sleep(2 + login_delay) driver.find_element_by_css_selector("#form-input-credential").send_keys(tesla_account_password) - time.sleep(2) + time.sleep(2 + login_delay) driver.find_element_by_css_selector("#form-submit-continue").click() return driver