首页 > 代码库 > python下载链接内容

python下载链接内容

下面代码下载京东注册码,可接收参数a.py num dir

#!/usr/bin/python#code utf-8import urllibimport timeimport sysimport osurlbase = https://authcode.jd.com/verify/image?a=0&acid=52b9316d-c9ab-4169-b39e-1217deaede7b&uid=52b9316d-c9ab-4169-b39           e-1217deaede7b&srcid=reg&is=7c63fc289d9ce9f3ba8304f74c1b9f19&yys=picnum = 10filedir = os.getcwd() + /lenarg = len(sys.argv)if lenarg == 2:    picnum = int(sys.argv[1])elif lenarg == 3:    picnum,filedir = int(sys.argv[1]), filedir+str(sys.argv[2])+/print file save at,filedirfor _ in range(picnum):    t = str(int(round(time.time()*1000)))    urllink = urlbase + t    print urllink    filename = filedir + t + .jpg    urllib.urlretrieve(urllink, filename)

 

python下载链接内容