Skip to content

Instantly share code, notes, and snippets.

@umrashrf
Created August 4, 2019 23:04
Show Gist options
  • Save umrashrf/9295a0160a6954c22ec01fa4f284c3f2 to your computer and use it in GitHub Desktop.
Save umrashrf/9295a0160a6954c22ec01fa4f284c3f2 to your computer and use it in GitHub Desktop.
Kijiji photo downloader in Python
photos = [
'https://i.ebayimg.com/00/s/MTA2N1gxNjAw/z/kXAAAOSwqYxdHbfJ/$_59.JPG',
]
import re
import urllib
basename = re.compile('/z/(.*)')
def fname(url):
return basename.search(url).group(1).replace('/', '_')
def dr(url):
for photo in photos:
yield urllib.request.urlretrieve(url, fname(url))
while True:
next(dr)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment