发布时间:2019-08-27 08:03:41编辑:auto阅读(2653)
- #!/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')
上一篇: Python在Linux下的Tab补齐(
下一篇: python正则捕获日志解析实例
54128
40884
35394
31038
25928
25665
24113
19645
15714
15187
1945°
1793°
1876°
1957°
1949°
2131°
2089°
1904°
1989°
1972°