From 103c508ffa74f7b0bd463271ab9ed3df87a0da59 Mon Sep 17 00:00:00 2001 From: gcmalloc Date: Tue, 23 Oct 2012 23:59:12 +0200 Subject: [PATCH] adding stanford open class courses --- test/test_download.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/test/test_download.py b/test/test_download.py index 9e0c52551..6ef166b2d 100644 --- a/test/test_download.py +++ b/test/test_download.py @@ -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: -- 2.39.5