Skip to content

Instantly share code, notes, and snippets.

@ahmadpriatama
Created June 16, 2015 16:59
Show Gist options
  • Save ahmadpriatama/621afd20e76d815863d2 to your computer and use it in GitHub Desktop.
Save ahmadpriatama/621afd20e76d815863d2 to your computer and use it in GitHub Desktop.
import urllib2, json, re, requests, sys, urllib, subprocess
ab = re.compile("_url.*\"(.*)\"")
prefix = "/home/ahmad/Downloads/WHMF/"
for i in range(7,55):
for j in range(1,5):
url = "http://video66.org/embed.php?w=790&h=480&vid=vids3/what_happens_to_my_family_-_" + str(i) + "_clip" +str(j)+ ".mp4"
req = urllib2.Request(url, headers={ 'User-Agent': 'Mozilla/5.0' })
html = urllib2.urlopen(req).read()
for line in html.split('\n'):
m = ab.match(line)
if m:
link = urllib2.unquote(m.group(1)).decode('utf8')
print "Downloading " + link
urllib.urlretrieve(link, prefix + str(i) + "-" + str(j) + ".mp4")
concatCommand = ["MP4Box", "-cat", prefix + str(i) + "-1.mp4", "-cat", prefix + str(i) + "-2.mp4", "-cat", prefix + str(i) + "-3.mp4", "-cat", prefix + str(i) + "-4.mp4", "-new", prefix + str(i) + ".mp4"]
subprocess.call(concatCommand)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment