]>
Raphaël G. Git Repositories - youtubedl/blob - test/test_playlists.py
706b6bdca1399284263106b755fdf9278c5d17d5
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
,
28 class TestPlaylists(unittest
.TestCase
):
29 def assertIsPlaylist(self
, info
):
30 """Make sure the info has '_type' set to 'playlist'"""
31 self
.assertEqual(info
['_type'], 'playlist')
33 def test_dailymotion_playlist(self
):
35 ie
= DailymotionPlaylistIE(dl
)
36 result
= ie
.extract('http://www.dailymotion.com/playlist/xv4bw_nqtv_sport/1#video=xl8v3q')
37 self
.assertIsPlaylist(result
)
38 self
.assertEqual(result
['title'], u
'SPORT')
39 self
.assertTrue(len(result
['entries']) > 20)
41 def test_dailymotion_user(self
):
43 ie
= DailymotionUserIE(dl
)
44 result
= ie
.extract('http://www.dailymotion.com/user/generation-quoi/')
45 self
.assertIsPlaylist(result
)
46 self
.assertEqual(result
['title'], u
'Génération Quoi')
47 self
.assertTrue(len(result
['entries']) >= 26)
49 def test_vimeo_channel(self
):
51 ie
= VimeoChannelIE(dl
)
52 result
= ie
.extract('http://vimeo.com/channels/tributes')
53 self
.assertIsPlaylist(result
)
54 self
.assertEqual(result
['title'], u
'Vimeo Tributes')
55 self
.assertTrue(len(result
['entries']) > 24)
57 def test_ustream_channel(self
):
59 ie
= UstreamChannelIE(dl
)
60 result
= ie
.extract('http://www.ustream.tv/channel/young-americans-for-liberty')
61 self
.assertIsPlaylist(result
)
62 self
.assertEqual(result
['id'], u
'5124905')
63 self
.assertTrue(len(result
['entries']) >= 11)
65 def test_soundcloud_set(self
):
67 ie
= SoundcloudSetIE(dl
)
68 result
= ie
.extract('https://soundcloud.com/the-concept-band/sets/the-royal-concept-ep')
69 self
.assertIsPlaylist(result
)
70 self
.assertEqual(result
['title'], u
'The Royal Concept EP')
71 self
.assertTrue(len(result
['entries']) >= 6)
73 def test_soundcloud_user(self
):
75 ie
= SoundcloudUserIE(dl
)
76 result
= ie
.extract('https://soundcloud.com/the-concept-band')
77 self
.assertIsPlaylist(result
)
78 self
.assertEqual(result
['id'], u
'9615865')
79 self
.assertTrue(len(result
['entries']) >= 12)
81 def test_livestream_event(self
):
84 result
= ie
.extract('http://new.livestream.com/tedx/cityenglish')
85 self
.assertIsPlaylist(result
)
86 self
.assertEqual(result
['title'], u
'TEDCity2.0 (English)')
87 self
.assertTrue(len(result
['entries']) >= 4)
89 def test_nhl_videocenter(self
):
91 ie
= NHLVideocenterIE(dl
)
92 result
= ie
.extract('http://video.canucks.nhl.com/videocenter/console?catid=999')
93 self
.assertIsPlaylist(result
)
94 self
.assertEqual(result
['id'], u
'999')
95 self
.assertEqual(result
['title'], u
'Highlights')
96 self
.assertEqual(len(result
['entries']), 12)
98 def test_bambuser_channel(self
):
100 ie
= BambuserChannelIE(dl
)
101 result
= ie
.extract('http://bambuser.com/channel/pixelversity')
102 self
.assertIsPlaylist(result
)
103 self
.assertEqual(result
['title'], u
'pixelversity')
104 self
.assertTrue(len(result
['entries']) >= 66)
106 if __name__
== '__main__':