完整代码
import requests
import re
import urllib.parse
from urllib import request
print('[2]1024*768\t\t[3]1280x720\t\t[4]1280x1024\t\t[5]1440x900\t\t[6]11920x1080\t\t[7]1920x1200\t\t[8]1920x1440\t\t')
size = input('请在以上尺寸中选择一项并输入括号内数字')
for x in range(25):
url = 'https://apps.game.qq.com/cgi-bin/ams/module/ishow/V1.0/query/workList_inc.cgi?activityId=2735&sVerifyCode=ABCD&sDataType=JSON&iListNum=4&totalpage=0&page=' + str(x) + '&iOrder=0&iSortNumClose=1&jsoncallback=jQuery171021125452438458137_1625972205037&iAMSActivityId=51991&_everyRead=true&iTypeId=1&iFlowId=267733&iActId=2735&iModuleId=2735&_=1625972205095'
response = requests.get(url)
print(response.text)
data = response.content.decode('utf-8')
imgSize = {'2':'sProdImgNo_2', '3':'sProdImgNo_3', '4':'sProdImgNo_4', '5':'sProdImgNo_5', '6':'sProdImgNo_6', '7':'sProdImgNo_7', '8':'sProdImgNo_8'}
sizeList = re.findall('"'+imgSize[size]+'":"(.*?)"',data)
nameList = re.findall('"sProdName":"(.*?)"',data)
for x in range(0,len(sizeList)):
imgurl = urllib.parse.unquote(sizeList[x]).replace('/200', '/0')
imgName = urllib.parse.unquote(nameList[x])
print('正在下载' + imgName + 'jpg')
request.urlretrieve(imgurl, 'king/'+imgName+'.jpg')
request.urlcleanup()
print(imgName + '.jpg下载完毕')