#coding:UTF-8
import urllib2
import os
import winsound
def save(string):
i=0
while True:
index = str(i).zfill(6)+'.ts' #补0
try: #不知道有多少ts文件,若存取失败则说明完成
url = 'http://vedio.leiphone.com/nfzWoRbIRB5rXxvcvYjdCdLaKCU=/'+string+'/'+index
f = urllib2.urlopen(url)
with open(index,'wb') as code:
code.write(f.read())
except:
print 'Ok'
break
i = i+1
def trans(name):
cmd = 'copy /b *.ts '+name+'.mp4'#合并ts为一个mp4
os.system(cmd)
os.system('del *.ts')#删除所有ts
if __name__ == '__main__':
while True:
string= raw_input('coding:')
name =raw_input('name:')
save(string)
trans(name)
winsound.Beep(600,1000) #时间有点长,设置结束提醒