]> jfr.im git - yt-dlp.git/blame - test/test_playlists.py
Fix test
[yt-dlp.git] / test / test_playlists.py
CommitLineData
a3c736de 1#!/usr/bin/env python
39baacc4 2# encoding: utf-8
a3c736de 3
a3c736de
JMF
4
5# Allow direct execution
6import os
44a5f171
PH
7import sys
8import unittest
9sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
10
11from test.helper import FakeYDL, global_setup
12global_setup()
13
a3c736de 14
39baacc4
JMF
15from youtube_dl.extractor import (
16 DailymotionPlaylistIE,
17 DailymotionUserIE,
18 VimeoChannelIE,
19 UstreamChannelIE,
20 SoundcloudUserIE,
b00ca882 21 LivestreamIE,
91dbaef4 22 NHLVideocenterIE,
39baacc4 23)
a3c736de 24
a3c736de
JMF
25
26class TestPlaylists(unittest.TestCase):
27 def assertIsPlaylist(self, info):
28 """Make sure the info has '_type' set to 'playlist'"""
29 self.assertEqual(info['_type'], 'playlist')
30
31 def test_dailymotion_playlist(self):
32 dl = FakeYDL()
33 ie = DailymotionPlaylistIE(dl)
34 result = ie.extract('http://www.dailymotion.com/playlist/xv4bw_nqtv_sport/1#video=xl8v3q')
35 self.assertIsPlaylist(result)
36 self.assertEqual(result['title'], u'SPORT')
37 self.assertTrue(len(result['entries']) > 20)
b00ca882 38
39baacc4
JMF
39 def test_dailymotion_user(self):
40 dl = FakeYDL()
41 ie = DailymotionUserIE(dl)
42 result = ie.extract('http://www.dailymotion.com/user/generation-quoi/')
43 self.assertIsPlaylist(result)
44 self.assertEqual(result['title'], u'Génération Quoi')
45 self.assertTrue(len(result['entries']) >= 26)
a3c736de 46
caeefc29
JMF
47 def test_vimeo_channel(self):
48 dl = FakeYDL()
49 ie = VimeoChannelIE(dl)
50 result = ie.extract('http://vimeo.com/channels/tributes')
51 self.assertIsPlaylist(result)
52 self.assertEqual(result['title'], u'Vimeo Tributes')
53 self.assertTrue(len(result['entries']) > 24)
54
74ac9bdd
JMF
55 def test_ustream_channel(self):
56 dl = FakeYDL()
57 ie = UstreamChannelIE(dl)
58 result = ie.extract('http://www.ustream.tv/channel/young-americans-for-liberty')
59 self.assertIsPlaylist(result)
60 self.assertEqual(result['id'], u'5124905')
61 self.assertTrue(len(result['entries']) >= 11)
62
92790f4e
JMF
63 def test_soundcloud_user(self):
64 dl = FakeYDL()
65 ie = SoundcloudUserIE(dl)
66 result = ie.extract('https://soundcloud.com/the-concept-band')
67 self.assertIsPlaylist(result)
68 self.assertEqual(result['id'], u'9615865')
69 self.assertTrue(len(result['entries']) >= 12)
70
b00ca882
JMF
71 def test_livestream_event(self):
72 dl = FakeYDL()
73 ie = LivestreamIE(dl)
74 result = ie.extract('http://new.livestream.com/tedx/cityenglish')
75 self.assertIsPlaylist(result)
76 self.assertEqual(result['title'], u'TEDCity2.0 (English)')
77 self.assertTrue(len(result['entries']) >= 4)
78
91dbaef4
JMF
79 def test_nhl_videocenter(self):
80 dl = FakeYDL()
81 ie = NHLVideocenterIE(dl)
82 result = ie.extract('http://video.canucks.nhl.com/videocenter/console?catid=999')
83 self.assertIsPlaylist(result)
84 self.assertEqual(result['id'], u'999')
85 self.assertEqual(result['title'], u'Highlights')
86 self.assertEqual(len(result['entries']), 12)
87
a3c736de
JMF
88if __name__ == '__main__':
89 unittest.main()