Code Monkey home page Code Monkey logo

teslaservicemanualscraper's Introduction

Tesla Service Manual Scraper

This script will download the Tesla Service Manual onto a local doc folder for offline access. Windows and MacOS (thanks to CollinHeist).

Setup

  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 S (2012-2020), but confirmed to work on the Model 3 too.
  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: https://wiki.python.org/moin/BeginnersGuide/Download
  5. Setup selenium for Python. To use the required stealth module, you must use the Chromium webdriver. See tutorial at: https://blog.testproject.io/2019/07/16/installing-selenium-webdriver-using-python-chrome/
  6. Pip install the required packages (including requests, selenium, selenium-stealth, and beautifulsoup4). On windows, you run the following commands on command prompt (CMD):
    1. cd C:\Users\Anson\Desktop\TeslaServiceManualScraper [template, the path should go wherever you saved this readme]
    2. run pip install -r requirements.txt
  7. Before scraping, it is always a good idea to use a VPN of some sort to avoid any issues with your account. I didn't run into any issues personally, but you can never be too safe. It is also worthwhile to open a new account to claim the manuals instead of using a personal account.
  8. Run scrape.py by typing python scrape.py
  9. The browser will automatically restart when it encounters problems with the files or login status.

Viewing offline

Option 1: Easy Way

  1. Go into docs/ folder and open up index.html. You're going to get 99% of the service manual just like that, but no search functionality.

Option 2: HTTP Server (thanks to TheNexusAvenger)

  1. Run CMD on Windows, and change the directory to the docs folder. Something like this cd C:\Users\Anson\Desktop\TeslaServiceManualScraper
  2. Run the following command: python -m http.server (Python obviously needs to be installed)
  3. Use a web browser and navigate to: http://localhost:8000/ to see the full service manual including search.

Tips

  • A full scrape of the Model 3 service manual took over 30 minutes. This script is set up so that you can stop the script, and then continue later on.
  • Keep an eye out, Tesla's website seems to boot you out of logged in status after about 250 pages or 20 minutes of continuous refreshing. So it might be worthwhile to run this on the side while keeping an eye on your login status.
  • Total file size of the Model 3 service manual is roughly 2.2GB.
  • On your first run, Tesla might throw a Captcha or lead to an error page. Most of the time, just rerun and it'll work.
  • If you get an "Access Denied" page, Tesla has likely blocked you. Usually that block expires in 10 minutes.
  • If you need to reset for any reason (scraping another manual), you need to delete or move the docs/ folder and the dict.picle file.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.