8 # Allow direct execution
10 sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
12 from youtube_dl.extractor import (
13 DailymotionPlaylistIE,
19 from youtube_dl.utils import *
21 from helper import FakeYDL
23 class TestPlaylists(unittest.TestCase):
24 def assertIsPlaylist(self, info):
25 """Make sure the info has '_type' set to 'playlist'"""
26 self.assertEqual(info['_type'], 'playlist')
28 def test_dailymotion_playlist(self):
30 ie = DailymotionPlaylistIE(dl)
31 result = ie.extract('http://www.dailymotion.com/playlist/xv4bw_nqtv_sport/1#video=xl8v3q')
32 self.assertIsPlaylist(result)
33 self.assertEqual(result['title'], u'SPORT')
34 self.assertTrue(len(result['entries']) > 20)
35 def test_dailymotion_user(self):
37 ie = DailymotionUserIE(dl)
38 result = ie.extract('http://www.dailymotion.com/user/generation-quoi/')
39 self.assertIsPlaylist(result)
40 self.assertEqual(result['title'], u'Génération Quoi')
41 self.assertTrue(len(result['entries']) >= 26)
43 def test_vimeo_channel(self):
45 ie = VimeoChannelIE(dl)
46 result = ie.extract('http://vimeo.com/channels/tributes')
47 self.assertIsPlaylist(result)
48 self.assertEqual(result['title'], u'Vimeo Tributes')
49 self.assertTrue(len(result['entries']) > 24)
51 def test_ustream_channel(self):
53 ie = UstreamChannelIE(dl)
54 result = ie.extract('http://www.ustream.tv/channel/young-americans-for-liberty')
55 self.assertIsPlaylist(result)
56 self.assertEqual(result['id'], u'5124905')
57 self.assertTrue(len(result['entries']) >= 11)
59 def test_soundcloud_user(self):
61 ie = SoundcloudUserIE(dl)
62 result = ie.extract('https://soundcloud.com/the-concept-band')
63 self.assertIsPlaylist(result)
64 self.assertEqual(result['id'], u'9615865')
65 self.assertTrue(len(result['entries']) >= 12)
67 if __name__ == '__main__':