- def test_youtube_playlist(self):
- DL = FakeDownloader()
- IE = YoutubePlaylistIE(DL)
- IE.extract('https://www.youtube.com/playlist?list=PLwiyx1dc3P2JR9N8gQaQN_BCvlSlap7re')
- self.assertEqual(map(lambda x: YoutubeIE()._extract_id(x[0]), DL.result),
- [ 'bV9L5Ht9LgY', 'FXxLjLQi3Fg', 'tU3Bgo5qJZE' ])
-
- #661
- DL = FakeDownloader()
- IE = YoutubePlaylistIE(DL)
- IE.extract('PLMCmkNmxw6Z9eduM7BZjSEh7HiU543Ig0')
- self.assertTrue(len(DL.result) > 20)
-
- #673
- DL = FakeDownloader()
- IE = YoutubePlaylistIE(DL)
- IE.extract('PLBB231211A4F62143')
- self.assertTrue(len(DL.result) > 40)
-
- def test_youtube_playlist_long(self):
- DL = FakeDownloader()
- IE = YoutubePlaylistIE(DL)
- IE.extract('https://www.youtube.com/playlist?list=UUBABnxM4Ar9ten8Mdjj1j0Q')
- self.assertTrue(len(DL.result) >= 799)
-
- def test_youtube_playlist_with_deleted(self):
- #651
- DL = FakeDownloader()
- IE = YoutubePlaylistIE(DL)
- IE.extract('https://www.youtube.com/playlist?list=PLwP_SiAcdui0KVebT0mU9Apz359a4ubsC')
- self.assertFalse('pElCt5oNDuI' in map(lambda x: YoutubeIE()._extract_id(x[0]), DL.result))
- self.assertFalse('KdPEApIVdWM' in map(lambda x: YoutubeIE()._extract_id(x[0]), DL.result))
+ def assertIsPlaylist(self, info):
+ """Make sure the info has '_type' set to 'playlist'"""
+ self.assertEqual(info['_type'], 'playlist')
+
+ def test_youtube_playlist_noplaylist(self):
+ dl = FakeYDL()
+ dl.params['noplaylist'] = True
+ ie = YoutubePlaylistIE(dl)
+ result = ie.extract('https://www.youtube.com/watch?v=FXxLjLQi3Fg&list=PLwiyx1dc3P2JR9N8gQaQN_BCvlSlap7re')
+ self.assertEqual(result['_type'], 'url')
+ self.assertEqual(YoutubeIE().extract_id(result['url']), 'FXxLjLQi3Fg')