]>
Raphaël G. Git Repositories - youtubedl/blob - test/test_playlists.py
8 # Allow direct execution
10 sys
.path
.append(os
.path
.dirname(os
.path
.dirname(os
.path
.abspath(__file__
))))
12 from youtube_dl
.extractor
import (
13 DailymotionPlaylistIE
,
20 from youtube_dl
.utils
import *
22 from helper
import FakeYDL
24 class TestPlaylists(unittest
.TestCase
):
25 def assertIsPlaylist(self
, info
):
26 """Make sure the info has '_type' set to 'playlist'"""
27 self
.assertEqual(info
['_type'], 'playlist')
29 def test_dailymotion_playlist(self
):
31 ie
= DailymotionPlaylistIE(dl
)
32 result
= ie
.extract('http://www.dailymotion.com/playlist/xv4bw_nqtv_sport/1#video=xl8v3q')
33 self
.assertIsPlaylist(result
)
34 self
.assertEqual(result
['title'], u
'SPORT')
35 self
.assertTrue(len(result
['entries']) > 20)
37 def test_dailymotion_user(self
):
39 ie
= DailymotionUserIE(dl
)
40 result
= ie
.extract('http://www.dailymotion.com/user/generation-quoi/')
41 self
.assertIsPlaylist(result
)
42 self
.assertEqual(result
['title'], u
'Génération Quoi')
43 self
.assertTrue(len(result
['entries']) >= 26)
45 def test_vimeo_channel(self
):
47 ie
= VimeoChannelIE(dl
)
48 result
= ie
.extract('http://vimeo.com/channels/tributes')
49 self
.assertIsPlaylist(result
)
50 self
.assertEqual(result
['title'], u
'Vimeo Tributes')
51 self
.assertTrue(len(result
['entries']) > 24)
53 def test_ustream_channel(self
):
55 ie
= UstreamChannelIE(dl
)
56 result
= ie
.extract('http://www.ustream.tv/channel/young-americans-for-liberty')
57 self
.assertIsPlaylist(result
)
58 self
.assertEqual(result
['id'], u
'5124905')
59 self
.assertTrue(len(result
['entries']) >= 11)
61 def test_soundcloud_user(self
):
63 ie
= SoundcloudUserIE(dl
)
64 result
= ie
.extract('https://soundcloud.com/the-concept-band')
65 self
.assertIsPlaylist(result
)
66 self
.assertEqual(result
['id'], u
'9615865')
67 self
.assertTrue(len(result
['entries']) >= 12)
69 def test_livestream_event(self
):
72 result
= ie
.extract('http://new.livestream.com/tedx/cityenglish')
73 self
.assertIsPlaylist(result
)
74 self
.assertEqual(result
['title'], u
'TEDCity2.0 (English)')
75 self
.assertTrue(len(result
['entries']) >= 4)
77 if __name__
== '__main__':