| 1234567891011121314151617181920212223242526 | #!/usr/bin/env pythonfrom __future__ import unicode_literals# Allow direct executionimport osimport sysimport unittestsys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))from youtube_dl.extractor import YoutubeIEclass TestYoutubeMisc(unittest.TestCase):    def test_youtube_extract(self):        assertExtractId = lambda url, id: self.assertEqual(YoutubeIE.extract_id(url), id)        assertExtractId('http://www.youtube.com/watch?&v=BaW_jenozKc', 'BaW_jenozKc')        assertExtractId('https://www.youtube.com/watch?&v=BaW_jenozKc', 'BaW_jenozKc')        assertExtractId('https://www.youtube.com/watch?feature=player_embedded&v=BaW_jenozKc', 'BaW_jenozKc')        assertExtractId('https://www.youtube.com/watch_popup?v=BaW_jenozKc', 'BaW_jenozKc')        assertExtractId('http://www.youtube.com/watch?v=BaW_jenozKcsharePLED17F32AD9753930', 'BaW_jenozKc')        assertExtractId('BaW_jenozKc', 'BaW_jenozKc')if __name__ == '__main__':    unittest.main()
 |