Last active
October 10, 2015 10:04
-
-
Save yukunlin/22754e813aa685f6cc60 to your computer and use it in GitHub Desktop.
Scrape Google Earth View web gallery for to download all images
This file contains 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
import requests | |
import multiprocessing as mp | |
url = 'http://earthview.withgoogle.com/download/' | |
def download_image(n): | |
try: | |
f = '%0.4d' % n + '.jpg' | |
r = requests.get(url+f) | |
if len(r.content) > 50000: | |
with open(f, 'w') as image: | |
image.write(r.content) | |
except KeyboardInterrupt: | |
raise Exception | |
args = range(1000, 8000) | |
pool = mp.Pool(8) | |
pool.map(download_image, args) | |
pool.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment