Created
June 27, 2020 17:09
-
-
Save jdeluyck/41b66a5a02e856a0e7da447ee93153e6 to your computer and use it in GitHub Desktop.
Quick and dirty script to download video files from teachable that youtube-dl flakes out on (for now)
This file contains 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
from html.parser import HTMLParser | |
import urllib.request | |
import re | |
import argparse | |
import wget | |
regex = r"\"url\":\"(.*?.bin)\"" | |
ap = argparse.ArgumentParser("DL") | |
ap.add_argument("-v", "--video", dest="video", required=True) | |
ap.add_argument("-f", "--filename", dest="fn", required=True) | |
args = ap.parse_args() | |
link = "https://fast.wistia.net/embed/iframe/{}?videoFoam=true".format(args.video) | |
foo = urllib.request.urlopen(link) | |
txt = foo.read().decode("utf-8") | |
print("Link: ", link) | |
matches = re.search(regex, txt) | |
if matches: | |
bin = matches.group(1) | |
else: | |
print ("Can't find bin file...") | |
exit (1) | |
print ("Downloading ", bin, " to ", args.fn) | |
wget.download(bin, args.fn) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment