You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.2 KiB

  1. #!/usr/bin/env python
  2. import sys
  3. import unittest
  4. import json
  5. # Allow direct execution
  6. import os
  7. sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
  8. from youtube_dl.extractor import DailymotionPlaylistIE, VimeoChannelIE
  9. from youtube_dl.utils import *
  10. from helper import FakeYDL
  11. class TestPlaylists(unittest.TestCase):
  12. def assertIsPlaylist(self, info):
  13. """Make sure the info has '_type' set to 'playlist'"""
  14. self.assertEqual(info['_type'], 'playlist')
  15. def test_dailymotion_playlist(self):
  16. dl = FakeYDL()
  17. ie = DailymotionPlaylistIE(dl)
  18. result = ie.extract('http://www.dailymotion.com/playlist/xv4bw_nqtv_sport/1#video=xl8v3q')
  19. self.assertIsPlaylist(result)
  20. self.assertEqual(result['title'], u'SPORT')
  21. self.assertTrue(len(result['entries']) > 20)
  22. def test_vimeo_channel(self):
  23. dl = FakeYDL()
  24. ie = VimeoChannelIE(dl)
  25. result = ie.extract('http://vimeo.com/channels/tributes')
  26. self.assertIsPlaylist(result)
  27. self.assertEqual(result['title'], u'Vimeo Tributes')
  28. self.assertTrue(len(result['entries']) > 24)
  29. if __name__ == '__main__':
  30. unittest.main()