def batch_download_image(img_url_arr):
img_arr = []
img_path = 'images/' + str(time.strftime('%Y-%m-%d')) + '/' + category + '/'
if not os.path.exists('./result/' + img_path):
os.makedirs('./result/' + img_path)
try:
for img_url in img_url_arr:
img_url = img_url['src']
img_name = str(int(time.time())) + '.jpg'
urlretrieve('https:' + img_url, './result/' + img_path + img_name)
img_arr.append(img_path + img_name)
return json.dumps(img_arr, ensure_ascii=False)
except os.error:
return ''