]> jfr.im git - yt-dlp.git/blob - test/test_playlists.py
[fktv] support videos splitted in any number of parts and some style changes
[yt-dlp.git] / test / test_playlists.py
1 #!/usr/bin/env python
2
3 import sys
4 import unittest
5 import json
6
7 # Allow direct execution
8 import os
9 sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
10
11 from youtube_dl.extractor import DailymotionPlaylistIE, VimeoChannelIE, UstreamChannelIE, SoundcloudUserIE
12 from youtube_dl.utils import *
13
14 from helper import FakeYDL
15
16 class TestPlaylists(unittest.TestCase):
17 def assertIsPlaylist(self, info):
18 """Make sure the info has '_type' set to 'playlist'"""
19 self.assertEqual(info['_type'], 'playlist')
20
21 def test_dailymotion_playlist(self):
22 dl = FakeYDL()
23 ie = DailymotionPlaylistIE(dl)
24 result = ie.extract('http://www.dailymotion.com/playlist/xv4bw_nqtv_sport/1#video=xl8v3q')
25 self.assertIsPlaylist(result)
26 self.assertEqual(result['title'], u'SPORT')
27 self.assertTrue(len(result['entries']) > 20)
28
29 def test_vimeo_channel(self):
30 dl = FakeYDL()
31 ie = VimeoChannelIE(dl)
32 result = ie.extract('http://vimeo.com/channels/tributes')
33 self.assertIsPlaylist(result)
34 self.assertEqual(result['title'], u'Vimeo Tributes')
35 self.assertTrue(len(result['entries']) > 24)
36
37 def test_ustream_channel(self):
38 dl = FakeYDL()
39 ie = UstreamChannelIE(dl)
40 result = ie.extract('http://www.ustream.tv/channel/young-americans-for-liberty')
41 self.assertIsPlaylist(result)
42 self.assertEqual(result['id'], u'5124905')
43 self.assertTrue(len(result['entries']) >= 11)
44
45 def test_soundcloud_user(self):
46 dl = FakeYDL()
47 ie = SoundcloudUserIE(dl)
48 result = ie.extract('https://soundcloud.com/the-concept-band')
49 self.assertIsPlaylist(result)
50 self.assertEqual(result['id'], u'9615865')
51 self.assertTrue(len(result['entries']) >= 12)
52
53 if __name__ == '__main__':
54 unittest.main()