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,
33 class TestPlaylists(unittest.TestCase):
34 def assertIsPlaylist(self, info):
35 """Make sure the info has '_type' set to 'playlist'"""
36 self.assertEqual(info['_type'], 'playlist')
38 def test_dailymotion_playlist(self):
40 ie = DailymotionPlaylistIE(dl)
41 result = ie.extract('http://www.dailymotion.com/playlist/xv4bw_nqtv_sport/1#video=xl8v3q')
42 self.assertIsPlaylist(result)
43 self.assertEqual(result['title'], u'SPORT')
44 self.assertTrue(len(result['entries']) > 20)
46 def test_dailymotion_user(self):
48 ie = DailymotionUserIE(dl)
49 result = ie.extract('http://www.dailymotion.com/user/generation-quoi/')
50 self.assertIsPlaylist(result)
51 self.assertEqual(result['title'], u'Génération Quoi')
52 self.assertTrue(len(result['entries']) >= 26)
54 def test_vimeo_channel(self):
56 ie = VimeoChannelIE(dl)
57 result = ie.extract('http://vimeo.com/channels/tributes')
58 self.assertIsPlaylist(result)
59 self.assertEqual(result['title'], u'Vimeo Tributes')
60 self.assertTrue(len(result['entries']) > 24)
62 def test_vimeo_user(self):
65 result = ie.extract('http://vimeo.com/nkistudio/videos')
66 self.assertIsPlaylist(result)
67 self.assertEqual(result['title'], u'Nki')
68 self.assertTrue(len(result['entries']) > 65)
70 def test_vimeo_album(self):
73 result = ie.extract('http://vimeo.com/album/2632481')
74 self.assertIsPlaylist(result)
75 self.assertEqual(result['title'], u'Staff Favorites: November 2013')
76 self.assertTrue(len(result['entries']) > 12)
78 def test_vimeo_groups(self):
80 ie = VimeoGroupsIE(dl)
81 result = ie.extract('http://vimeo.com/groups/rolexawards')
82 self.assertIsPlaylist(result)
83 self.assertEqual(result['title'], u'Rolex Awards for Enterprise')
84 self.assertTrue(len(result['entries']) > 72)
86 def test_ustream_channel(self):
88 ie = UstreamChannelIE(dl)
89 result = ie.extract('http://www.ustream.tv/channel/young-americans-for-liberty')
90 self.assertIsPlaylist(result)
91 self.assertEqual(result['id'], u'5124905')
92 self.assertTrue(len(result['entries']) >= 11)
94 def test_soundcloud_set(self):
96 ie = SoundcloudSetIE(dl)
97 result = ie.extract('https://soundcloud.com/the-concept-band/sets/the-royal-concept-ep')
98 self.assertIsPlaylist(result)
99 self.assertEqual(result['title'], u'The Royal Concept EP')
100 self.assertTrue(len(result['entries']) >= 6)
102 def test_soundcloud_user(self):
104 ie = SoundcloudUserIE(dl)
105 result = ie.extract('https://soundcloud.com/the-concept-band')
106 self.assertIsPlaylist(result)
107 self.assertEqual(result['id'], u'9615865')
108 self.assertTrue(len(result['entries']) >= 12)
110 def test_livestream_event(self):
112 ie = LivestreamIE(dl)
113 result = ie.extract('http://new.livestream.com/tedx/cityenglish')
114 self.assertIsPlaylist(result)
115 self.assertEqual(result['title'], u'TEDCity2.0 (English)')
116 self.assertTrue(len(result['entries']) >= 4)
118 def test_nhl_videocenter(self):
120 ie = NHLVideocenterIE(dl)
121 result = ie.extract('http://video.canucks.nhl.com/videocenter/console?catid=999')
122 self.assertIsPlaylist(result)
123 self.assertEqual(result['id'], u'999')
124 self.assertEqual(result['title'], u'Highlights')
125 self.assertEqual(len(result['entries']), 12)
127 def test_bambuser_channel(self):
129 ie = BambuserChannelIE(dl)
130 result = ie.extract('http://bambuser.com/channel/pixelversity')
131 self.assertIsPlaylist(result)
132 self.assertEqual(result['title'], u'pixelversity')
133 self.assertTrue(len(result['entries']) >= 60)
135 def test_bandcamp_album(self):
137 ie = BandcampAlbumIE(dl)
138 result = ie.extract('http://mpallante.bandcamp.com/album/nightmare-night-ep')
139 self.assertIsPlaylist(result)
140 self.assertEqual(result['title'], u'Nightmare Night EP')
141 self.assertTrue(len(result['entries']) >= 4)
143 def test_smotri_community(self):
145 ie = SmotriCommunityIE(dl)
146 result = ie.extract('http://smotri.com/community/video/kommuna')
147 self.assertIsPlaylist(result)
148 self.assertEqual(result['id'], u'kommuna')
149 self.assertEqual(result['title'], u'КПРФ')
150 self.assertTrue(len(result['entries']) >= 4)
152 def test_smotri_user(self):
154 ie = SmotriUserIE(dl)
155 result = ie.extract('http://smotri.com/user/inspector')
156 self.assertIsPlaylist(result)
157 self.assertEqual(result['id'], u'inspector')
158 self.assertEqual(result['title'], u'Inspector')
159 self.assertTrue(len(result['entries']) >= 9)
161 if __name__ == '__main__':