import urllib
import urllib.request as request
def download(url, name):
try:
urllib.request.urlretrieve(url, name)
except Exception as e:
print(e)
download(url, name)
with open("hk.txt") as f:
url_list = f.read().split('\n')
count = 0
for url in url_list:
img_name = url.split("_")[1].split("/")[-1] + "_" + str(count)
print(img_name)
if count % 5 == 0:
download(url, "img/" + img_name + ".jpg")
count += 1