]>
Raphaël G. Git Repositories - youtubedl/blob - test/test_playlists.py
00c950109111c709be0228f351220532c638467f
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
,
31 class TestPlaylists(unittest
.TestCase
):
32 def assertIsPlaylist(self
, info
):
33 """Make sure the info has '_type' set to 'playlist'"""
34 self
.assertEqual(info
['_type'], 'playlist')
36 def test_dailymotion_playlist(self
):
38 ie
= DailymotionPlaylistIE(dl
)
39 result
= ie
.extract('http://www.dailymotion.com/playlist/xv4bw_nqtv_sport/1#video=xl8v3q')
40 self
.assertIsPlaylist(result
)
41 self
.assertEqual(result
['title'], u
'SPORT')
42 self
.assertTrue(len(result
['entries']) > 20)
44 def test_dailymotion_user(self
):
46 ie
= DailymotionUserIE(dl
)
47 result
= ie
.extract('http://www.dailymotion.com/user/generation-quoi/')
48 self
.assertIsPlaylist(result
)
49 self
.assertEqual(result
['title'], u
'Génération Quoi')
50 self
.assertTrue(len(result
['entries']) >= 26)
52 def test_vimeo_channel(self
):
54 ie
= VimeoChannelIE(dl
)
55 result
= ie
.extract('http://vimeo.com/channels/tributes')
56 self
.assertIsPlaylist(result
)
57 self
.assertEqual(result
['title'], u
'Vimeo Tributes')
58 self
.assertTrue(len(result
['entries']) > 24)
60 def test_vimeo_user(self
):
63 result
= ie
.extract('http://vimeo.com/nkistudio/videos')
64 self
.assertIsPlaylist(result
)
65 self
.assertEqual(result
['title'], u
'Nki')
66 self
.assertTrue(len(result
['entries']) > 65)
68 def test_ustream_channel(self
):
70 ie
= UstreamChannelIE(dl
)
71 result
= ie
.extract('http://www.ustream.tv/channel/young-americans-for-liberty')
72 self
.assertIsPlaylist(result
)
73 self
.assertEqual(result
['id'], u
'5124905')
74 self
.assertTrue(len(result
['entries']) >= 11)
76 def test_soundcloud_set(self
):
78 ie
= SoundcloudSetIE(dl
)
79 result
= ie
.extract('https://soundcloud.com/the-concept-band/sets/the-royal-concept-ep')
80 self
.assertIsPlaylist(result
)
81 self
.assertEqual(result
['title'], u
'The Royal Concept EP')
82 self
.assertTrue(len(result
['entries']) >= 6)
84 def test_soundcloud_user(self
):
86 ie
= SoundcloudUserIE(dl
)
87 result
= ie
.extract('https://soundcloud.com/the-concept-band')
88 self
.assertIsPlaylist(result
)
89 self
.assertEqual(result
['id'], u
'9615865')
90 self
.assertTrue(len(result
['entries']) >= 12)
92 def test_livestream_event(self
):
95 result
= ie
.extract('http://new.livestream.com/tedx/cityenglish')
96 self
.assertIsPlaylist(result
)
97 self
.assertEqual(result
['title'], u
'TEDCity2.0 (English)')
98 self
.assertTrue(len(result
['entries']) >= 4)
100 def test_nhl_videocenter(self
):
102 ie
= NHLVideocenterIE(dl
)
103 result
= ie
.extract('http://video.canucks.nhl.com/videocenter/console?catid=999')
104 self
.assertIsPlaylist(result
)
105 self
.assertEqual(result
['id'], u
'999')
106 self
.assertEqual(result
['title'], u
'Highlights')
107 self
.assertEqual(len(result
['entries']), 12)
109 def test_bambuser_channel(self
):
111 ie
= BambuserChannelIE(dl
)
112 result
= ie
.extract('http://bambuser.com/channel/pixelversity')
113 self
.assertIsPlaylist(result
)
114 self
.assertEqual(result
['title'], u
'pixelversity')
115 self
.assertTrue(len(result
['entries']) >= 60)
117 def test_bandcamp_album(self
):
119 ie
= BandcampAlbumIE(dl
)
120 result
= ie
.extract('http://mpallante.bandcamp.com/album/nightmare-night-ep')
121 self
.assertIsPlaylist(result
)
122 self
.assertEqual(result
['title'], u
'Nightmare Night EP')
123 self
.assertTrue(len(result
['entries']) >= 4)
125 def test_smotri_community(self
):
127 ie
= SmotriCommunityIE(dl
)
128 result
= ie
.extract('http://smotri.com/community/video/kommuna')
129 self
.assertIsPlaylist(result
)
130 self
.assertEqual(result
['id'], u
'kommuna')
131 self
.assertEqual(result
['title'], u
'КПРФ')
132 self
.assertTrue(len(result
['entries']) >= 4)
134 def test_smotri_user(self
):
136 ie
= SmotriUserIE(dl
)
137 result
= ie
.extract('http://smotri.com/user/inspector')
138 self
.assertIsPlaylist(result
)
139 self
.assertEqual(result
['id'], u
'inspector')
140 self
.assertEqual(result
['title'], u
'Inspector')
141 self
.assertTrue(len(result
['entries']) >= 9)
143 if __name__
== '__main__':