]> jfr.im git - yt-dlp.git/blob - test/test_youtube_misc.py
[cleanup] Upgrade syntax
[yt-dlp.git] / test / test_youtube_misc.py
1 #!/usr/bin/env python3
2 # Allow direct execution
3 import os
4 import sys
5 import unittest
6 sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
7
8
9 from yt_dlp.extractor import YoutubeIE
10
11
12 class TestYoutubeMisc(unittest.TestCase):
13 def test_youtube_extract(self):
14 assertExtractId = lambda url, id: self.assertEqual(YoutubeIE.extract_id(url), id)
15 assertExtractId('http://www.youtube.com/watch?&v=BaW_jenozKc', 'BaW_jenozKc')
16 assertExtractId('https://www.youtube.com/watch?&v=BaW_jenozKc', 'BaW_jenozKc')
17 assertExtractId('https://www.youtube.com/watch?feature=player_embedded&v=BaW_jenozKc', 'BaW_jenozKc')
18 assertExtractId('https://www.youtube.com/watch_popup?v=BaW_jenozKc', 'BaW_jenozKc')
19 assertExtractId('http://www.youtube.com/watch?v=BaW_jenozKcsharePLED17F32AD9753930', 'BaW_jenozKc')
20 assertExtractId('BaW_jenozKc', 'BaW_jenozKc')
21
22
23 if __name__ == '__main__':
24 unittest.main()