import urllibimport redef cbk(a, b, c): per = 100.0 * a * b / c if per > 100: per = 100 print '%.2f%%' % per def getHtml(url): page = urllib.urlopen(url) html = page.read() page.close() return htmldef getVideo(html): reg = 'src="(.*?.mp4)" ' reg2='\d{2}-\w+\.mp4$' videore = re.compile(reg) videourl = videore.findall(html) for vurl in videourl: print vurl a=re.search(reg2, vurl) res=a.group() urllib.urlretrieve(vurl, res,cbk) nu = [11,12,13]for num in nu: lc = getHtml(r"http://www.linuxcast.net/public/cast_show/%s"%(num)) print getVideo(lc)
报错如下:
莫回无
摇曳的蔷薇