]> jfr.im git - yt-dlp.git/blob - test/test_youtube_misc.py
[cleanup] Sort imports
[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
7 sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
8
9
10 from yt_dlp.extractor import YoutubeIE
11
12
13 class TestYoutubeMisc(unittest.TestCase):
14 def test_youtube_extract(self):
15 assertExtractId = lambda url, id: self.assertEqual(YoutubeIE.extract_id(url), id)
16 assertExtractId('http://www.youtube.com/watch?&v=BaW_jenozKc', 'BaW_jenozKc')
17 assertExtractId('https://www.youtube.com/watch?&v=BaW_jenozKc', 'BaW_jenozKc')
18 assertExtractId('https://www.youtube.com/watch?feature=player_embedded&v=BaW_jenozKc', 'BaW_jenozKc')
19 assertExtractId('https://www.youtube.com/watch_popup?v=BaW_jenozKc', 'BaW_jenozKc')
20 assertExtractId('http://www.youtube.com/watch?v=BaW_jenozKcsharePLED17F32AD9753930', 'BaW_jenozKc')
21 assertExtractId('BaW_jenozKc', 'BaW_jenozKc')
22
23
24 if __name__ == '__main__':
25 unittest.main()