i'm trying to download magic the gathering cards' images from scryfall.com. they provide this json file with all informations about every single card (including the url for its image). so i wrote a code that reads every url from that json file, and attemps to save it. the thing is, the request part of the code takes more than 5 minutes per image to run and i have no idea why. (the size of each image i'm fetching is less than 100kB and opens instantenously on the browser)
i have tried urllib.urlretrieve, urllib2.urlopen, and it's all the same. tried running it on both python2 and python3.
no error messages, the code actually works, only the long time it takes makes it unviable to carry on with it.
edit:
a=open("cards.json")
b=a.read()
data=[]
data.append(b)
count=0
for elem in data:
try:
content=json.loads(elem)
except:
print content
exit()
for j in content:
count=count+1
if j['layout']=='normal' and j['digital']==False:
url=str(j['image_uris']['normal'])
final=url[url.find('normal')+6:]
print (url)
print("a")
i1=urllib.urlretrieve(url)
print("b")
i2=i1.read()
file=open(str(count),'wb')
file.write(i2)
file.close()
if count>5:
exit()
edit2: the link to the json i'm using: https://archive.scryfall.com/json/scryfall-default-cards.json