]>
Raphaël G. Git Repositories - youtubedl/blob - test/test_playlists.py
   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
, 
  26 class TestPlaylists(unittest
.TestCase
): 
  27     def assertIsPlaylist(self
, info
): 
  28         """Make sure the info has '_type' set to 'playlist'""" 
  29         self
.assertEqual(info
['_type'], 'playlist') 
  31     def test_dailymotion_playlist(self
): 
  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) 
  39     def test_dailymotion_user(self
): 
  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) 
  47     def test_vimeo_channel(self
): 
  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) 
  55     def test_ustream_channel(self
): 
  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) 
  63     def test_soundcloud_user(self
): 
  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) 
  71     def test_livestream_event(self
): 
  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) 
  79     def test_nhl_videocenter(self
): 
  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) 
  88 if __name__ 
== '__main__':