- #!/usr/bin/python
- # -*- coding: utf-8 -*-
-
- import urllib,re
-
- url1 = 'http://www.csvt.net/resource/videos'
- headers = ('User-Agent','Mozilla/5.0 (Windows NT 5.1; rv:14.0) Gecko/20100101 Firefox/14.0.1')
- opener.addheaders = [headers]
- data = urllib.urlopen(url1).read()
- data = data.decode('utf8')
- downurl = re.findall(re.compile(r'file=(.*)&dis'),data)
- name=re.findall(r'largesize" target="_blank">(.*)</a>',data)
- file=open('downurl.txt','w')
- for i in range(len(downurl)):
- print name[i]+" "+"http://csvt-course.b0.upaiyun.com"+downurl[i]
- #rllib.urlretrieve("http://csvt-course.b0.upaiyun.com"+downurl[i],name[i]+'.flv') #download file
- url="http://csvt-course.b0.upaiyun.com"+downurl[i]
- file.write(url+'\n')
- print '-'*100
- file.close()
-
- for i1 in range(len(downurl)):
- print 'download files ing..............................................'
- rllib.urlretrieve("http://csvt-course.b0.upaiyun.com"+downurl[i],name[i]+'.flv')
-