]>
jfr.im git - yt-dlp.git/blob - test/test_playlists.py
7c67239a438917fd6e64af152cb63c124ff6721c
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
,
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_ustream_channel(self
):
60 ie
= UstreamChannelIE(dl
)
61 result
= ie
.extract('http://www.ustream.tv/channel/young-americans-for-liberty')
62 self
.assertIsPlaylist(result
)
63 self
.assertEqual(result
['id'], u
'5124905')
64 self
.assertTrue(len(result
['entries']) >= 11)
66 def test_soundcloud_set(self
):
68 ie
= SoundcloudSetIE(dl
)
69 result
= ie
.extract('https://soundcloud.com/the-concept-band/sets/the-royal-concept-ep')
70 self
.assertIsPlaylist(result
)
71 self
.assertEqual(result
['title'], u
'The Royal Concept EP')
72 self
.assertTrue(len(result
['entries']) >= 6)
74 def test_soundcloud_user(self
):
76 ie
= SoundcloudUserIE(dl
)
77 result
= ie
.extract('https://soundcloud.com/the-concept-band')
78 self
.assertIsPlaylist(result
)
79 self
.assertEqual(result
['id'], u
'9615865')
80 self
.assertTrue(len(result
['entries']) >= 12)
82 def test_livestream_event(self
):
85 result
= ie
.extract('http://new.livestream.com/tedx/cityenglish')
86 self
.assertIsPlaylist(result
)
87 self
.assertEqual(result
['title'], u
'TEDCity2.0 (English)')
88 self
.assertTrue(len(result
['entries']) >= 4)
90 def test_nhl_videocenter(self
):
92 ie
= NHLVideocenterIE(dl
)
93 result
= ie
.extract('http://video.canucks.nhl.com/videocenter/console?catid=999')
94 self
.assertIsPlaylist(result
)
95 self
.assertEqual(result
['id'], u
'999')
96 self
.assertEqual(result
['title'], u
'Highlights')
97 self
.assertEqual(len(result
['entries']), 12)
99 def test_bambuser_channel(self
):
101 ie
= BambuserChannelIE(dl
)
102 result
= ie
.extract('http://bambuser.com/channel/pixelversity')
103 self
.assertIsPlaylist(result
)
104 self
.assertEqual(result
['title'], u
'pixelversity')
105 self
.assertTrue(len(result
['entries']) >= 60)
107 def test_bandcamp_album(self
):
109 ie
= BandcampAlbumIE(dl
)
110 result
= ie
.extract('http://mpallante.bandcamp.com/album/nightmare-night-ep')
111 self
.assertIsPlaylist(result
)
112 self
.assertEqual(result
['title'], u
'Nightmare Night EP')
113 self
.assertTrue(len(result
['entries']) >= 4)
115 if __name__
== '__main__':