From d5a398988bb4db5ea610e3cb2548f0e084a1137e Mon Sep 17 00:00:00 2001 From: pukkandan Date: Thu, 3 Feb 2022 21:21:42 +0530 Subject: [PATCH] Update to ytdl-commit-78ce962 [youtube] Support channel search https://github.com/ytdl-org/youtube-dl/commit/78ce962f4fe020994c216dd2671546fbe58a5c67 --- .gitignore | 2 +- Makefile | 2 +- README.md | 2 +- test/test_youtube_lists.py | 30 ++++-------------------------- test/test_youtube_signature.py | 9 ++++++++- yt_dlp/compat.py | 7 +++++++ 6 files changed, 22 insertions(+), 30 deletions(-) diff --git a/.gitignore b/.gitignore index ff00620f5..5dc82ccbe 100644 --- a/.gitignore +++ b/.gitignore @@ -92,7 +92,7 @@ README.txt *.tar.gz *.zsh *.spec -test/testdata/player-*.js +test/testdata/sigs/player-*.js # Binary /youtube-dl diff --git a/Makefile b/Makefile index 32aabfbe6..b65ec9515 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ pypi-files: AUTHORS Changelog.md LICENSE README.md README.txt supportedsites com .PHONY: all clean install test tar pypi-files completions ot offlinetest codetest supportedsites clean-test: - rm -rf test/testdata/player-*.js tmp/ *.annotations.xml *.aria2 *.description *.dump *.frag \ + rm -rf test/testdata/sigs/player-*.js tmp/ *.annotations.xml *.aria2 *.description *.dump *.frag \ *.frag.aria2 *.frag.urls *.info.json *.live_chat.json *.meta *.part* *.tmp *.temp *.unknown_video *.ytdl \ *.3gp *.ape *.avi *.desktop *.flac *.flv *.jpeg *.jpg *.m4a *.m4v *.mhtml *.mkv *.mov *.mp3 \ *.mp4 *.ogg *.opus *.png *.sbv *.srt *.swf *.swp *.ttml *.url *.vtt *.wav *.webloc *.webm *.webp diff --git a/README.md b/README.md index a3cd9ba7b..5644a6367 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ yt-dlp is a [youtube-dl](https://github.com/ytdl-org/youtube-dl) fork based on t # NEW FEATURES -* Based on **youtube-dl 2021.12.17 [commit/5014bd6](https://github.com/ytdl-org/youtube-dl/commit/5014bd67c22b421207b2650d4dc874b95b36dda1)** and **youtube-dlc 2020.11.11-3 [commit/f9401f2](https://github.com/blackjack4494/yt-dlc/commit/f9401f2a91987068139c5f757b12fc711d4c0cee)**: You get all the features and patches of [youtube-dlc](https://github.com/blackjack4494/yt-dlc) in addition to the latest [youtube-dl](https://github.com/ytdl-org/youtube-dl) +* Based on **youtube-dl 2021.12.17 [commit/78ce962](https://github.com/ytdl-org/youtube-dl/commit/78ce962f4fe020994c216dd2671546fbe58a5c67)** and **youtube-dlc 2020.11.11-3 [commit/f9401f2](https://github.com/blackjack4494/yt-dlc/commit/f9401f2a91987068139c5f757b12fc711d4c0cee)**: You get all the features and patches of [youtube-dlc](https://github.com/blackjack4494/yt-dlc) in addition to the latest [youtube-dl](https://github.com/ytdl-org/youtube-dl) * **[SponsorBlock Integration](#sponsorblock-options)**: You can mark/remove sponsor sections in youtube videos by utilizing the [SponsorBlock](https://sponsor.ajay.app) API diff --git a/test/test_youtube_lists.py b/test/test_youtube_lists.py index d9638658d..455192b1f 100644 --- a/test/test_youtube_lists.py +++ b/test/test_youtube_lists.py @@ -9,11 +9,9 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from test.helper import FakeYDL, is_download_test - from yt_dlp.extractor import ( - YoutubePlaylistIE, - YoutubeTabIE, YoutubeIE, + YoutubeTabIE, ) @@ -27,21 +25,10 @@ class TestYoutubeLists(unittest.TestCase): dl = FakeYDL() dl.params['noplaylist'] = True ie = YoutubeTabIE(dl) - result = ie.extract('https://www.youtube.com/watch?v=FXxLjLQi3Fg&list=PLwiyx1dc3P2JR9N8gQaQN_BCvlSlap7re') + result = ie.extract('https://www.youtube.com/watch?v=OmJ-4B-mS-Y&list=PLydZ2Hrp_gPRJViZjLFKaBMgCQOYEEkyp&index=2') self.assertEqual(result['_type'], 'url') - self.assertEqual(YoutubeIE.extract_id(result['url']), 'FXxLjLQi3Fg') - - def test_youtube_course(self): - print('Skipping: Course URLs no longer exists') - return - dl = FakeYDL() - ie = YoutubePlaylistIE(dl) - # TODO find a > 100 (paginating?) videos course - result = ie.extract('https://www.youtube.com/course?list=ECUl4u3cNGP61MdtwGTqZA0MreSaDybji8') - entries = list(result['entries']) - self.assertEqual(YoutubeIE.extract_id(entries[0]['url']), 'j9WZyLZCBzs') - self.assertEqual(len(entries), 25) - self.assertEqual(YoutubeIE.extract_id(entries[-1]['url']), 'rYefUsYuEp0') + self.assertEqual(result['ie_key'], YoutubeIE.ie_key()) + self.assertEqual(YoutubeIE.extract_id(result['url']), 'OmJ-4B-mS-Y') def test_youtube_mix(self): dl = FakeYDL() @@ -52,15 +39,6 @@ class TestYoutubeLists(unittest.TestCase): original_video = entries[0] self.assertEqual(original_video['id'], 'tyITL_exICo') - def test_youtube_toptracks(self): - print('Skipping: The playlist page gives error 500') - return - dl = FakeYDL() - ie = YoutubePlaylistIE(dl) - result = ie.extract('https://www.youtube.com/playlist?list=MCUS') - entries = result['entries'] - self.assertEqual(len(entries), 100) - def test_youtube_flat_playlist_extraction(self): dl = FakeYDL() dl.params['extract_flat'] = True diff --git a/test/test_youtube_signature.py b/test/test_youtube_signature.py index 537eb8ba2..cb07d3e23 100644 --- a/test/test_youtube_signature.py +++ b/test/test_youtube_signature.py @@ -120,10 +120,17 @@ class TestPlayerInfo(unittest.TestCase): class TestSignature(unittest.TestCase): def setUp(self): TEST_DIR = os.path.dirname(os.path.abspath(__file__)) - self.TESTDATA_DIR = os.path.join(TEST_DIR, 'testdata') + self.TESTDATA_DIR = os.path.join(TEST_DIR, 'testdata/sigs') if not os.path.exists(self.TESTDATA_DIR): os.mkdir(self.TESTDATA_DIR) + def tearDown(self): + try: + for f in os.listdir(self.TESTDATA_DIR): + os.remove(f) + except OSError: + pass + def t_factory(name, sig_func, url_pattern): def make_tfunc(url, sig_input, expected_sig): diff --git a/yt_dlp/compat.py b/yt_dlp/compat.py index 79c8e3494..b97d4512e 100644 --- a/yt_dlp/compat.py +++ b/yt_dlp/compat.py @@ -2,6 +2,7 @@ import asyncio import base64 +import collections import ctypes import getpass import html @@ -180,14 +181,17 @@ def windows_enable_vt_mode(): # TODO: Do this the proper way https://bugs.pytho compat_basestring = str compat_chr = chr +compat_filter = filter compat_input = input compat_integer_types = (int, ) compat_kwargs = lambda kwargs: kwargs +compat_map = map compat_numeric_types = (int, float, complex) compat_str = str compat_xpath = lambda xpath: xpath compat_zip = zip +compat_collections_abc = collections.abc compat_HTMLParser = html.parser.HTMLParser compat_HTTPError = urllib.error.HTTPError compat_Struct = struct.Struct @@ -245,6 +249,7 @@ __all__ = [ 'compat_b64decode', 'compat_basestring', 'compat_chr', + 'compat_collections_abc', 'compat_cookiejar', 'compat_cookiejar_Cookie', 'compat_cookies', @@ -254,6 +259,7 @@ __all__ = [ 'compat_etree_fromstring', 'compat_etree_register_namespace', 'compat_expanduser', + 'compat_filter', 'compat_get_terminal_size', 'compat_getenv', 'compat_getpass', @@ -265,6 +271,7 @@ __all__ = [ 'compat_integer_types', 'compat_itertools_count', 'compat_kwargs', + 'compat_map', 'compat_numeric_types', 'compat_ord', 'compat_os_name',