adding stanford open class courses
This commit is contained in:
parent
2876773381
commit
103c508ffa
@ -8,7 +8,7 @@ from youtube_dl.FileDownloader import FileDownloader
|
||||
from youtube_dl.InfoExtractors import YoutubeIE, DailymotionIE
|
||||
from youtube_dl.InfoExtractors import MetacafeIE, BlipTVIE
|
||||
from youtube_dl.InfoExtractors import XVideosIE, VimeoIE
|
||||
from youtube_dl.InfoExtractors import SoundcloudIE
|
||||
from youtube_dl.InfoExtractors import SoundcloudIE, StanfordOpenClassroomIE
|
||||
|
||||
|
||||
class DownloadTest(unittest.TestCase):
|
||||
@ -44,6 +44,11 @@ class DownloadTest(unittest.TestCase):
|
||||
SOUNDCLOUD_URL = "http://soundcloud.com/ethmusic/lostin-powers-she-so-heavy"
|
||||
SOUNDCLOUD_FILE = "n6FLbx6ZzMiu.mp3"
|
||||
|
||||
|
||||
STANDFORD_MD5 = "22c8206291368c4e2c9c1a307f0ea0f4"
|
||||
STANDFORD_URL = "http://openclassroom.stanford.edu/MainFolder/VideoPage.php?course=PracticalUnix&video=intro-environment&speed=100"
|
||||
STANDFORD_FILE = "PracticalUnix_intro-environment.mp4"
|
||||
|
||||
def test_youtube(self):
|
||||
#let's download a file from youtube
|
||||
with open(DownloadTest.PARAMETERS_FILE) as f:
|
||||
@ -108,6 +113,15 @@ class DownloadTest(unittest.TestCase):
|
||||
md5_down_file = md5_for_file(DownloadTest.SOUNDCLOUD_FILE)
|
||||
self.assertEqual(md5_down_file, DownloadTest.SOUNDCLOUD_MD5)
|
||||
|
||||
def test_standford(self):
|
||||
with open(DownloadTest.PARAMETERS_FILE) as f:
|
||||
fd = FileDownloader(json.load(f))
|
||||
fd.add_info_extractor(StanfordOpenClassroomIE())
|
||||
fd.download([DownloadTest.STANDFORD_URL])
|
||||
self.assertTrue(os.path.exists(DownloadTest.STANDFORD_FILE))
|
||||
md5_down_file = md5_for_file(DownloadTest.STANDFORD_FILE)
|
||||
self.assertEqual(md5_down_file, DownloadTest.STANDFORD_MD5)
|
||||
|
||||
def tearDown(self):
|
||||
if os.path.exists(DownloadTest.YOUTUBE_FILE):
|
||||
os.remove(DownloadTest.YOUTUBE_FILE)
|
||||
@ -123,6 +137,8 @@ class DownloadTest(unittest.TestCase):
|
||||
os.remove(DownloadTest.VIMEO_FILE)
|
||||
if os.path.exists(DownloadTest.SOUNDCLOUD_FILE):
|
||||
os.remove(DownloadTest.SOUNDCLOUD_FILE)
|
||||
if os.path.exists(DownloadTest.STANDFORD_FILE):
|
||||
os.remove(DownloadTest.STANDFORD_FILE)
|
||||
|
||||
def md5_for_file(filename, block_size=2**20):
|
||||
with open(filename) as f:
|
||||
|
Loading…
Reference in New Issue
Block a user