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
14 from youtube_dl.extractor import (
15 DailymotionPlaylistIE,
29 class TestPlaylists(unittest.TestCase):
30 def assertIsPlaylist(self, info):
31 """Make sure the info has '_type' set to 'playlist'"""
32 self.assertEqual(info['_type'], 'playlist')
34 def test_dailymotion_playlist(self):
36 ie = DailymotionPlaylistIE(dl)
37 result = ie.extract('http://www.dailymotion.com/playlist/xv4bw_nqtv_sport/1#video=xl8v3q')
38 self.assertIsPlaylist(result)
39 self.assertEqual(result['title'], u'SPORT')
40 self.assertTrue(len(result['entries']) > 20)
42 def test_dailymotion_user(self):
44 ie = DailymotionUserIE(dl)
45 result = ie.extract('http://www.dailymotion.com/user/generation-quoi/')
46 self.assertIsPlaylist(result)
47 self.assertEqual(result['title'], u'Génération Quoi')
48 self.assertTrue(len(result['entries']) >= 26)
50 def test_vimeo_channel(self):
52 ie = VimeoChannelIE(dl)
53 result = ie.extract('http://vimeo.com/channels/tributes')
54 self.assertIsPlaylist(result)
55 self.assertEqual(result['title'], u'Vimeo Tributes')
56 self.assertTrue(len(result['entries']) > 24)
58 def test_vimeo_user(self):
61 result = ie.extract('http://vimeo.com/nkistudio/videos')
62 self.assertIsPlaylist(result)
63 self.assertEqual(result['title'], u'Nki')
64 self.assertTrue(len(result['entries']) > 65)
66 def test_ustream_channel(self):
68 ie = UstreamChannelIE(dl)
69 result = ie.extract('http://www.ustream.tv/channel/young-americans-for-liberty')
70 self.assertIsPlaylist(result)
71 self.assertEqual(result['id'], u'5124905')
72 self.assertTrue(len(result['entries']) >= 11)
74 def test_soundcloud_set(self):
76 ie = SoundcloudSetIE(dl)
77 result = ie.extract('https://soundcloud.com/the-concept-band/sets/the-royal-concept-ep')
78 self.assertIsPlaylist(result)
79 self.assertEqual(result['title'], u'The Royal Concept EP')
80 self.assertTrue(len(result['entries']) >= 6)
82 def test_soundcloud_user(self):
84 ie = SoundcloudUserIE(dl)
85 result = ie.extract('https://soundcloud.com/the-concept-band')
86 self.assertIsPlaylist(result)
87 self.assertEqual(result['id'], u'9615865')
88 self.assertTrue(len(result['entries']) >= 12)
90 def test_livestream_event(self):
93 result = ie.extract('http://new.livestream.com/tedx/cityenglish')
94 self.assertIsPlaylist(result)
95 self.assertEqual(result['title'], u'TEDCity2.0 (English)')
96 self.assertTrue(len(result['entries']) >= 4)
98 def test_nhl_videocenter(self):
100 ie = NHLVideocenterIE(dl)
101 result = ie.extract('http://video.canucks.nhl.com/videocenter/console?catid=999')
102 self.assertIsPlaylist(result)
103 self.assertEqual(result['id'], u'999')
104 self.assertEqual(result['title'], u'Highlights')
105 self.assertEqual(len(result['entries']), 12)
107 def test_bambuser_channel(self):
109 ie = BambuserChannelIE(dl)
110 result = ie.extract('http://bambuser.com/channel/pixelversity')
111 self.assertIsPlaylist(result)
112 self.assertEqual(result['title'], u'pixelversity')
113 self.assertTrue(len(result['entries']) >= 60)
115 def test_bandcamp_album(self):
117 ie = BandcampAlbumIE(dl)
118 result = ie.extract('http://mpallante.bandcamp.com/album/nightmare-night-ep')
119 self.assertIsPlaylist(result)
120 self.assertEqual(result['title'], u'Nightmare Night EP')
121 self.assertTrue(len(result['entries']) >= 4)
123 if __name__ == '__main__':