aboutsummaryrefslogtreecommitdiff
path: root/test/test_download.py
diff options
context:
space:
mode:
authorgcmalloc <gcmalloc@gmail.com>2012-10-23 23:59:12 +0200
committergcmalloc <gcmalloc@gmail.com>2012-10-23 23:59:12 +0200
commit103c508ffa74f7b0bd463271ab9ed3df87a0da59 (patch)
tree34b07a60683d4f7ab2c12c12f7e1e97d71646fb6 /test/test_download.py
parent28767733814e0490fc426603d207efc966a00af0 (diff)
downloadyoutube-dl-103c508ffa74f7b0bd463271ab9ed3df87a0da59.tar.xz
adding stanford open class courses
Diffstat (limited to 'test/test_download.py')
-rw-r--r--test/test_download.py18
1 files changed, 17 insertions, 1 deletions
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: