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.

27 lines
1.1 KiB

  1. #!/usr/bin/env python
  2. import sys
  3. import unittest
  4. # Allow direct execution
  5. import os
  6. sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
  7. from youtube_dl.InfoExtractors import YoutubeIE, YoutubePlaylistIE
  8. class TestAllURLsMatching(unittest.TestCase):
  9. def test_youtube_playlist_matching(self):
  10. self.assertTrue(YoutubePlaylistIE().suitable(u'ECUl4u3cNGP61MdtwGTqZA0MreSaDybji8'))
  11. self.assertTrue(YoutubePlaylistIE().suitable(u'PL63F0C78739B09958'))
  12. self.assertFalse(YoutubePlaylistIE().suitable(u'PLtS2H6bU1M'))
  13. def test_youtube_matching(self):
  14. self.assertTrue(YoutubeIE().suitable(u'PLtS2H6bU1M'))
  15. def test_youtube_extract(self):
  16. self.assertEqual(YoutubeIE()._extract_id('http://www.youtube.com/watch?&v=BaW_jenozKc'), 'BaW_jenozKc')
  17. self.assertEqual(YoutubeIE()._extract_id('https://www.youtube.com/watch?&v=BaW_jenozKc'), 'BaW_jenozKc')
  18. self.assertEqual(YoutubeIE()._extract_id('https://www.youtube.com/watch?feature=player_embedded&v=BaW_jenozKc'), 'BaW_jenozKc')
  19. if __name__ == '__main__':
  20. unittest.main()