Untitled
raw download clone
TEXT
views 7
,
size 1081 b
import requests
import time
import urllib.request
found = False




def download(url):
    fullname = str(i)+".jpg"
    print("Downloading --> " + fullname)
    urllib.request.urlretrieve(url,fullname)
    print("------Download complete!------")
def found(url):
    global found
    print("found!")
    print(url)
    download(url)
    found = True




#url_example = "https://cdnlearn.s3.amazonaws.com/exam/quiz/202108H/cp1/cp108/cp108-0100-78.png"




#數字+數字
for i in range(75,80):
    if found == True:
    	pass
    else:
        if len(str(i)) == 1:
            i = "0"+str(i)
        else:
            i = str(i)
        r = requests.get(f"https://cdnlearn.s3.amazonaws.com/exam/quiz/202108H/cp1/cp108/cp108-0100-{i}.png")
        print(str(r.status_code) + " | checking --> " + f"{i}.png")
        if r.status_code == 200:
            found(f"https://cdnlearn.s3.amazonaws.com/exam/quiz/202108H/cp1/cp108/cp108-0100-{i}.png")
            
#數字+英文
close fullscreen
Login or Register to edit or fork this paste. It's free.