Created
October 22, 2016 07:55
-
-
Save sfantree/c5494a3963d1397aedbb86c7381ed5a2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import re | |
import urllib | |
def getHtml(url): | |
page=urllib.urlopen(url) | |
html=page.read() | |
return html | |
def getMp4(html): | |
r=r"href='(http.*\.mp4)'" | |
re_mp4=re.compile(r) | |
mp4List=re.findall(re_mp4,html) | |
filename=1 | |
for mp4url in mp4List: | |
urllib.urlretrieve(mp4url,"%s.mp4" %filename) | |
print 'file "%s.mp4" done' %filename | |
filename+=1 | |
url=raw_input("please input the source url:") | |
html=getHtml(url) | |
getMp4(html) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment