Created
December 22, 2019 03:09
-
-
Save djstein/97bb73a1a8808f40cae7a7ab9f43706d to your computer and use it in GitHub Desktop.
Tesla CPO Photos Downloader
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Tesla CPO Photos Downloader | |
# Tired of seeing blurry images of your Tesla CPO order? | |
# Insert the url your sales rep sent you with the blurry images, | |
# and have the high resolution versions downloaded to your computer! | |
# | |
# Simply run: | |
# python3 tesla-cpo-photos.py https://backwebs.homenetinc.com/tesla/details/@/your-unique-reference-number/ | |
# | |
# No dependencies required | |
# Dylan Stein ([email protected]) | |
# | |
import sys | |
import urllib.request | |
def download_images(url): | |
image_urls = [] | |
with urllib.request.urlopen(url) as source: | |
for line in source.readlines(): | |
line = str(line) | |
if 'open-photoviewer-prettyphoto photoindex-' in line: | |
image_url = line.split('href=')[1].split(' ')[0][1:-1] | |
image_urls.append(image_url) | |
for image_url in image_urls: | |
urllib.request.urlretrieve(image_url, image_url.split('/')[-1]) | |
if __name__ == "__main__": | |
download_images(sys.argv[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment