5 # Allow direct execution
9 sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
11 from test.helper import FakeYDL, global_setup
15 from youtube_dl.extractor import (
16 DailymotionPlaylistIE,
27 class TestPlaylists(unittest.TestCase):
28 def assertIsPlaylist(self, info):
29 """Make sure the info has '_type' set to 'playlist'"""
30 self.assertEqual(info['_type'], 'playlist')
32 def test_dailymotion_playlist(self):
34 ie = DailymotionPlaylistIE(dl)
35 result = ie.extract('http://www.dailymotion.com/playlist/xv4bw_nqtv_sport/1#video=xl8v3q')
36 self.assertIsPlaylist(result)
37 self.assertEqual(result['title'], u'SPORT')
38 self.assertTrue(len(result['entries']) > 20)
40 def test_dailymotion_user(self):
42 ie = DailymotionUserIE(dl)
43 result = ie.extract('http://www.dailymotion.com/user/generation-quoi/')
44 self.assertIsPlaylist(result)
45 self.assertEqual(result['title'], u'Génération Quoi')
46 self.assertTrue(len(result['entries']) >= 26)
48 def test_vimeo_channel(self):
50 ie = VimeoChannelIE(dl)
51 result = ie.extract('http://vimeo.com/channels/tributes')
52 self.assertIsPlaylist(result)
53 self.assertEqual(result['title'], u'Vimeo Tributes')
54 self.assertTrue(len(result['entries']) > 24)
56 def test_ustream_channel(self):
58 ie = UstreamChannelIE(dl)
59 result = ie.extract('http://www.ustream.tv/channel/young-americans-for-liberty')
60 self.assertIsPlaylist(result)
61 self.assertEqual(result['id'], u'5124905')
62 self.assertTrue(len(result['entries']) >= 11)
64 def test_soundcloud_user(self):
66 ie = SoundcloudUserIE(dl)
67 result = ie.extract('https://soundcloud.com/the-concept-band')
68 self.assertIsPlaylist(result)
69 self.assertEqual(result['id'], u'9615865')
70 self.assertTrue(len(result['entries']) >= 12)
72 def test_livestream_event(self):
75 result = ie.extract('http://new.livestream.com/tedx/cityenglish')
76 self.assertIsPlaylist(result)
77 self.assertEqual(result['title'], u'TEDCity2.0 (English)')
78 self.assertTrue(len(result['entries']) >= 4)
80 def test_nhl_videocenter(self):
82 ie = NHLVideocenterIE(dl)
83 result = ie.extract('http://video.canucks.nhl.com/videocenter/console?catid=999')
84 self.assertIsPlaylist(result)
85 self.assertEqual(result['id'], u'999')
86 self.assertEqual(result['title'], u'Highlights')
87 self.assertEqual(len(result['entries']), 12)
89 def test_bambuser_channel(self):
91 ie = BambuserChannelIE(dl)
92 result = ie.extract('http://bambuser.com/channel/pixelversity')
93 self.assertIsPlaylist(result)
94 self.assertEqual(result['title'], u'pixelversity')
95 self.assertTrue(len(result['entries']) >= 66)
97 if __name__ == '__main__':