From cefecac12cd3c70f9c7a30992c60b05c2eb5d34e Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 2 Sep 2020 20:25:25 +0200 Subject: [skip travis] renaming to avoid using same folder when using pip install for example --- test/helper.py | 10 +++++----- test/test_InfoExtractor.py | 8 ++++---- test/test_YoutubeDL.py | 12 ++++++------ test/test_YoutubeDLCookieJar.py | 2 +- test/test_aes.py | 4 ++-- test/test_age_restriction.py | 2 +- test/test_all_urls.py | 4 ++-- test/test_cache.py | 2 +- test/test_compat.py | 14 +++++++------- test/test_download.py | 12 ++++++------ test/test_downloader_http.py | 8 ++++---- test/test_execution.py | 10 +++++----- test/test_http.py | 4 ++-- test/test_iqiyi_sdk_interpreter.py | 2 +- test/test_jsinterp.py | 2 +- test/test_netrc.py | 2 +- test/test_options.py | 2 +- test/test_postprocessors.py | 2 +- test/test_socks.py | 2 +- test/test_subtitles.py | 2 +- test/test_swfinterp.py | 2 +- test/test_update.py | 2 +- test/test_utils.py | 14 +++++++------- test/test_verbose_output.py | 8 ++++---- test/test_write_annotations.py | 8 ++++---- test/test_youtube_chapters.py | 2 +- test/test_youtube_lists.py | 2 +- test/test_youtube_signature.py | 4 ++-- 28 files changed, 74 insertions(+), 74 deletions(-) (limited to 'test') diff --git a/test/helper.py b/test/helper.py index e62aab11e..f45818b0f 100644 --- a/test/helper.py +++ b/test/helper.py @@ -10,13 +10,13 @@ import types import ssl import sys -import youtube_dl.extractor -from youtube_dl import YoutubeDL -from youtube_dl.compat import ( +import youtube_dlc.extractor +from youtube_dlc import YoutubeDL +from youtube_dlc.compat import ( compat_os_name, compat_str, ) -from youtube_dl.utils import ( +from youtube_dlc.utils import ( preferredencoding, write_string, ) @@ -90,7 +90,7 @@ class FakeYDL(YoutubeDL): def gettestcases(include_onlymatching=False): - for ie in youtube_dl.extractor.gen_extractors(): + for ie in youtube_dlc.extractor.gen_extractors(): for tc in ie.get_testcases(include_onlymatching): yield tc diff --git a/test/test_InfoExtractor.py b/test/test_InfoExtractor.py index 71f6608fe..bdd01e41a 100644 --- a/test/test_InfoExtractor.py +++ b/test/test_InfoExtractor.py @@ -10,10 +10,10 @@ import unittest sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from test.helper import FakeYDL, expect_dict, expect_value, http_server_port -from youtube_dl.compat import compat_etree_fromstring, compat_http_server -from youtube_dl.extractor.common import InfoExtractor -from youtube_dl.extractor import YoutubeIE, get_info_extractor -from youtube_dl.utils import encode_data_uri, strip_jsonp, ExtractorError, RegexNotFoundError +from youtube_dlc.compat import compat_etree_fromstring, compat_http_server +from youtube_dlc.extractor.common import InfoExtractor +from youtube_dlc.extractor import YoutubeIE, get_info_extractor +from youtube_dlc.utils import encode_data_uri, strip_jsonp, ExtractorError, RegexNotFoundError import threading diff --git a/test/test_YoutubeDL.py b/test/test_YoutubeDL.py index 1e204e551..6d02c2a54 100644 --- a/test/test_YoutubeDL.py +++ b/test/test_YoutubeDL.py @@ -12,12 +12,12 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) import copy from test.helper import FakeYDL, assertRegexpMatches -from youtube_dl import YoutubeDL -from youtube_dl.compat import compat_str, compat_urllib_error -from youtube_dl.extractor import YoutubeIE -from youtube_dl.extractor.common import InfoExtractor -from youtube_dl.postprocessor.common import PostProcessor -from youtube_dl.utils import ExtractorError, match_filter_func +from youtube_dlc import YoutubeDL +from youtube_dlc.compat import compat_str, compat_urllib_error +from youtube_dlc.extractor import YoutubeIE +from youtube_dlc.extractor.common import InfoExtractor +from youtube_dlc.postprocessor.common import PostProcessor +from youtube_dlc.utils import ExtractorError, match_filter_func TEST_URL = 'http://localhost/sample.mp4' diff --git a/test/test_YoutubeDLCookieJar.py b/test/test_YoutubeDLCookieJar.py index 05f48bd74..615d8a9d8 100644 --- a/test/test_YoutubeDLCookieJar.py +++ b/test/test_YoutubeDLCookieJar.py @@ -10,7 +10,7 @@ import tempfile import unittest sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -from youtube_dl.utils import YoutubeDLCookieJar +from youtube_dlc.utils import YoutubeDLCookieJar class TestYoutubeDLCookieJar(unittest.TestCase): diff --git a/test/test_aes.py b/test/test_aes.py index cc89fb6ab..ef1e1b189 100644 --- a/test/test_aes.py +++ b/test/test_aes.py @@ -8,8 +8,8 @@ import sys import unittest sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -from youtube_dl.aes import aes_decrypt, aes_encrypt, aes_cbc_decrypt, aes_cbc_encrypt, aes_decrypt_text -from youtube_dl.utils import bytes_to_intlist, intlist_to_bytes +from youtube_dlc.aes import aes_decrypt, aes_encrypt, aes_cbc_decrypt, aes_cbc_encrypt, aes_decrypt_text +from youtube_dlc.utils import bytes_to_intlist, intlist_to_bytes import base64 # the encrypted data can be generate with 'devscripts/generate_aes_testdata.py' diff --git a/test/test_age_restriction.py b/test/test_age_restriction.py index 6f5513faa..b73bdd767 100644 --- a/test/test_age_restriction.py +++ b/test/test_age_restriction.py @@ -10,7 +10,7 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from test.helper import try_rm -from youtube_dl import YoutubeDL +from youtube_dlc import YoutubeDL def _download_restricted(url, filename, age): diff --git a/test/test_all_urls.py b/test/test_all_urls.py index 81056a999..7b6664cac 100644 --- a/test/test_all_urls.py +++ b/test/test_all_urls.py @@ -12,7 +12,7 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from test.helper import gettestcases -from youtube_dl.extractor import ( +from youtube_dlc.extractor import ( FacebookIE, gen_extractors, YoutubeIE, @@ -70,7 +70,7 @@ class TestAllURLsMatching(unittest.TestCase): def test_youtube_search_matching(self): self.assertMatch('http://www.youtube.com/results?search_query=making+mustard', ['youtube:search_url']) - self.assertMatch('https://www.youtube.com/results?baz=bar&search_query=youtube-dl+test+video&filters=video&lclk=video', ['youtube:search_url']) + self.assertMatch('https://www.youtube.com/results?baz=bar&search_query=youtube-dlc+test+video&filters=video&lclk=video', ['youtube:search_url']) def test_youtube_extract(self): assertExtractId = lambda url, id: self.assertEqual(YoutubeIE.extract_id(url), id) diff --git a/test/test_cache.py b/test/test_cache.py index a16160142..1167519d1 100644 --- a/test/test_cache.py +++ b/test/test_cache.py @@ -13,7 +13,7 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from test.helper import FakeYDL -from youtube_dl.cache import Cache +from youtube_dlc.cache import Cache def _is_empty(d): diff --git a/test/test_compat.py b/test/test_compat.py index 86ff389fd..8c49a001e 100644 --- a/test/test_compat.py +++ b/test/test_compat.py @@ -10,7 +10,7 @@ import unittest sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -from youtube_dl.compat import ( +from youtube_dlc.compat import ( compat_getenv, compat_setenv, compat_etree_Element, @@ -28,11 +28,11 @@ from youtube_dl.compat import ( class TestCompat(unittest.TestCase): def test_compat_getenv(self): test_str = 'тест' - compat_setenv('YOUTUBE_DL_COMPAT_GETENV', test_str) - self.assertEqual(compat_getenv('YOUTUBE_DL_COMPAT_GETENV'), test_str) + compat_setenv('youtube_dlc_COMPAT_GETENV', test_str) + self.assertEqual(compat_getenv('youtube_dlc_COMPAT_GETENV'), test_str) def test_compat_setenv(self): - test_var = 'YOUTUBE_DL_COMPAT_SETENV' + test_var = 'youtube_dlc_COMPAT_SETENV' test_str = 'тест' compat_setenv(test_var, test_str) compat_getenv(test_var) @@ -46,11 +46,11 @@ class TestCompat(unittest.TestCase): compat_setenv('HOME', old_home or '') def test_all_present(self): - import youtube_dl.compat - all_names = youtube_dl.compat.__all__ + import youtube_dlc.compat + all_names = youtube_dlc.compat.__all__ present_names = set(filter( lambda c: '_' in c and not c.startswith('_'), - dir(youtube_dl.compat))) - set(['unicode_literals']) + dir(youtube_dlc.compat))) - set(['unicode_literals']) self.assertEqual(all_names, sorted(present_names)) def test_compat_urllib_parse_unquote(self): diff --git a/test/test_download.py b/test/test_download.py index ebe820dfc..bcd3b4041 100644 --- a/test/test_download.py +++ b/test/test_download.py @@ -24,24 +24,24 @@ import io import json import socket -import youtube_dl.YoutubeDL -from youtube_dl.compat import ( +import youtube_dlc.YoutubeDL +from youtube_dlc.compat import ( compat_http_client, compat_urllib_error, compat_HTTPError, ) -from youtube_dl.utils import ( +from youtube_dlc.utils import ( DownloadError, ExtractorError, format_bytes, UnavailableVideoError, ) -from youtube_dl.extractor import get_info_extractor +from youtube_dlc.extractor import get_info_extractor RETRIES = 3 -class YoutubeDL(youtube_dl.YoutubeDL): +class YoutubeDL(youtube_dlc.YoutubeDL): def __init__(self, *args, **kwargs): self.to_stderr = self.to_screen self.processed_info_dicts = [] @@ -92,7 +92,7 @@ class TestDownload(unittest.TestCase): def generator(test_case, tname): def test_template(self): - ie = youtube_dl.extractor.get_info_extractor(test_case['name'])() + ie = youtube_dlc.extractor.get_info_extractor(test_case['name'])() other_ies = [get_info_extractor(ie_key)() for ie_key in test_case.get('add_ie', [])] is_playlist = any(k.startswith('playlist') for k in test_case) test_cases = test_case.get( diff --git a/test/test_downloader_http.py b/test/test_downloader_http.py index 750472281..c8e28bd3a 100644 --- a/test/test_downloader_http.py +++ b/test/test_downloader_http.py @@ -10,10 +10,10 @@ import unittest sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from test.helper import http_server_port, try_rm -from youtube_dl import YoutubeDL -from youtube_dl.compat import compat_http_server -from youtube_dl.downloader.http import HttpFD -from youtube_dl.utils import encodeFilename +from youtube_dlc import YoutubeDL +from youtube_dlc.compat import compat_http_server +from youtube_dlc.downloader.http import HttpFD +from youtube_dlc.utils import encodeFilename import threading TEST_DIR = os.path.dirname(os.path.abspath(__file__)) diff --git a/test/test_execution.py b/test/test_execution.py index 11661bb68..b18e63d73 100644 --- a/test/test_execution.py +++ b/test/test_execution.py @@ -10,7 +10,7 @@ import os import subprocess sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -from youtube_dl.utils import encodeArgument +from youtube_dlc.utils import encodeArgument rootDir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) @@ -23,18 +23,18 @@ except AttributeError: class TestExecution(unittest.TestCase): def test_import(self): - subprocess.check_call([sys.executable, '-c', 'import youtube_dl'], cwd=rootDir) + subprocess.check_call([sys.executable, '-c', 'import youtube_dlc'], cwd=rootDir) def test_module_exec(self): if sys.version_info >= (2, 7): # Python 2.6 doesn't support package execution - subprocess.check_call([sys.executable, '-m', 'youtube_dl', '--version'], cwd=rootDir, stdout=_DEV_NULL) + subprocess.check_call([sys.executable, '-m', 'youtube_dlc', '--version'], cwd=rootDir, stdout=_DEV_NULL) def test_main_exec(self): - subprocess.check_call([sys.executable, 'youtube_dl/__main__.py', '--version'], cwd=rootDir, stdout=_DEV_NULL) + subprocess.check_call([sys.executable, 'youtube_dlc/__main__.py', '--version'], cwd=rootDir, stdout=_DEV_NULL) def test_cmdline_umlauts(self): p = subprocess.Popen( - [sys.executable, 'youtube_dl/__main__.py', encodeArgument('ä'), '--version'], + [sys.executable, 'youtube_dlc/__main__.py', encodeArgument('ä'), '--version'], cwd=rootDir, stdout=_DEV_NULL, stderr=subprocess.PIPE) _, stderr = p.communicate() self.assertFalse(stderr) diff --git a/test/test_http.py b/test/test_http.py index 3ee0a5dda..55c3c6183 100644 --- a/test/test_http.py +++ b/test/test_http.py @@ -9,8 +9,8 @@ import unittest sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from test.helper import http_server_port -from youtube_dl import YoutubeDL -from youtube_dl.compat import compat_http_server, compat_urllib_request +from youtube_dlc import YoutubeDL +from youtube_dlc.compat import compat_http_server, compat_urllib_request import ssl import threading diff --git a/test/test_iqiyi_sdk_interpreter.py b/test/test_iqiyi_sdk_interpreter.py index 789059dbe..303609baa 100644 --- a/test/test_iqiyi_sdk_interpreter.py +++ b/test/test_iqiyi_sdk_interpreter.py @@ -9,7 +9,7 @@ import unittest sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from test.helper import FakeYDL -from youtube_dl.extractor import IqiyiIE +from youtube_dlc.extractor import IqiyiIE class IqiyiIEWithCredentials(IqiyiIE): diff --git a/test/test_jsinterp.py b/test/test_jsinterp.py index c24b8ca74..97fc8d5aa 100644 --- a/test/test_jsinterp.py +++ b/test/test_jsinterp.py @@ -8,7 +8,7 @@ import sys import unittest sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -from youtube_dl.jsinterp import JSInterpreter +from youtube_dlc.jsinterp import JSInterpreter class TestJSInterpreter(unittest.TestCase): diff --git a/test/test_netrc.py b/test/test_netrc.py index 7cf3a6a2e..566ba37a6 100644 --- a/test/test_netrc.py +++ b/test/test_netrc.py @@ -7,7 +7,7 @@ import unittest sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -from youtube_dl.extractor import ( +from youtube_dlc.extractor import ( gen_extractors, ) diff --git a/test/test_options.py b/test/test_options.py index 3a25a6ba3..dce253373 100644 --- a/test/test_options.py +++ b/test/test_options.py @@ -8,7 +8,7 @@ import sys import unittest sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -from youtube_dl.options import _hide_login_info +from youtube_dlc.options import _hide_login_info class TestOptions(unittest.TestCase): diff --git a/test/test_postprocessors.py b/test/test_postprocessors.py index 4209d1d9a..6f538a3da 100644 --- a/test/test_postprocessors.py +++ b/test/test_postprocessors.py @@ -8,7 +8,7 @@ import sys import unittest sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -from youtube_dl.postprocessor import MetadataFromTitlePP +from youtube_dlc.postprocessor import MetadataFromTitlePP class TestMetadataFromTitle(unittest.TestCase): diff --git a/test/test_socks.py b/test/test_socks.py index 1e68eb0da..be52e2343 100644 --- a/test/test_socks.py +++ b/test/test_socks.py @@ -15,7 +15,7 @@ from test.helper import ( FakeYDL, get_params, ) -from youtube_dl.compat import ( +from youtube_dlc.compat import ( compat_str, compat_urllib_request, ) diff --git a/test/test_subtitles.py b/test/test_subtitles.py index 17aaaf20d..3ca03fb6f 100644 --- a/test/test_subtitles.py +++ b/test/test_subtitles.py @@ -10,7 +10,7 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from test.helper import FakeYDL, md5 -from youtube_dl.extractor import ( +from youtube_dlc.extractor import ( YoutubeIE, DailymotionIE, TEDIE, diff --git a/test/test_swfinterp.py b/test/test_swfinterp.py index 9f18055e6..1a8b353e8 100644 --- a/test/test_swfinterp.py +++ b/test/test_swfinterp.py @@ -14,7 +14,7 @@ import json import re import subprocess -from youtube_dl.swfinterp import SWFInterpreter +from youtube_dlc.swfinterp import SWFInterpreter TEST_DIR = os.path.join( diff --git a/test/test_update.py b/test/test_update.py index d9c71511d..1b144c43c 100644 --- a/test/test_update.py +++ b/test/test_update.py @@ -10,7 +10,7 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) import json -from youtube_dl.update import rsa_verify +from youtube_dlc.update import rsa_verify class TestUpdate(unittest.TestCase): diff --git a/test/test_utils.py b/test/test_utils.py index 0896f4150..663a34e07 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -15,7 +15,7 @@ import io import json import xml.etree.ElementTree -from youtube_dl.utils import ( +from youtube_dlc.utils import ( age_restricted, args_to_str, encode_base_n, @@ -105,7 +105,7 @@ from youtube_dl.utils import ( cli_bool_option, parse_codecs, ) -from youtube_dl.compat import ( +from youtube_dlc.compat import ( compat_chr, compat_etree_fromstring, compat_getenv, @@ -240,12 +240,12 @@ class TestUtil(unittest.TestCase): def env(var): return '%{0}%'.format(var) if sys.platform == 'win32' else '${0}'.format(var) - compat_setenv('YOUTUBE_DL_EXPATH_PATH', 'expanded') - self.assertEqual(expand_path(env('YOUTUBE_DL_EXPATH_PATH')), 'expanded') + compat_setenv('youtube_dlc_EXPATH_PATH', 'expanded') + self.assertEqual(expand_path(env('youtube_dlc_EXPATH_PATH')), 'expanded') self.assertEqual(expand_path(env('HOME')), compat_getenv('HOME')) self.assertEqual(expand_path('~'), compat_getenv('HOME')) self.assertEqual( - expand_path('~/%s' % env('YOUTUBE_DL_EXPATH_PATH')), + expand_path('~/%s' % env('youtube_dlc_EXPATH_PATH')), '%s/expanded' % compat_getenv('HOME')) def test_prepend_extension(self): @@ -1388,8 +1388,8 @@ Line 1 self.assertEqual(caesar('ebg', 'acegik', -2), 'abc') def test_rot47(self): - self.assertEqual(rot47('youtube-dl'), r'J@FEF36\5=') - self.assertEqual(rot47('YOUTUBE-DL'), r'*~&%&qt\s{') + self.assertEqual(rot47('youtube-dlc'), r'J@FEF36\5=') + self.assertEqual(rot47('youtube-dlc'), r'*~&%&qt\s{') def test_urshift(self): self.assertEqual(urshift(3, 1), 1) diff --git a/test/test_verbose_output.py b/test/test_verbose_output.py index c1465fe8c..462f25e03 100644 --- a/test/test_verbose_output.py +++ b/test/test_verbose_output.py @@ -17,7 +17,7 @@ class TestVerboseOutput(unittest.TestCase): def test_private_info_arg(self): outp = subprocess.Popen( [ - sys.executable, 'youtube_dl/__main__.py', '-v', + sys.executable, 'youtube_dlc/__main__.py', '-v', '--username', 'johnsmith@gmail.com', '--password', 'secret', ], cwd=rootDir, stdout=subprocess.PIPE, stderr=subprocess.PIPE) @@ -30,7 +30,7 @@ class TestVerboseOutput(unittest.TestCase): def test_private_info_shortarg(self): outp = subprocess.Popen( [ - sys.executable, 'youtube_dl/__main__.py', '-v', + sys.executable, 'youtube_dlc/__main__.py', '-v', '-u', 'johnsmith@gmail.com', '-p', 'secret', ], cwd=rootDir, stdout=subprocess.PIPE, stderr=subprocess.PIPE) @@ -43,7 +43,7 @@ class TestVerboseOutput(unittest.TestCase): def test_private_info_eq(self): outp = subprocess.Popen( [ - sys.executable, 'youtube_dl/__main__.py', '-v', + sys.executable, 'youtube_dlc/__main__.py', '-v', '--username=johnsmith@gmail.com', '--password=secret', ], cwd=rootDir, stdout=subprocess.PIPE, stderr=subprocess.PIPE) @@ -56,7 +56,7 @@ class TestVerboseOutput(unittest.TestCase): def test_private_info_shortarg_eq(self): outp = subprocess.Popen( [ - sys.executable, 'youtube_dl/__main__.py', '-v', + sys.executable, 'youtube_dlc/__main__.py', '-v', '-u=johnsmith@gmail.com', '-p=secret', ], cwd=rootDir, stdout=subprocess.PIPE, stderr=subprocess.PIPE) diff --git a/test/test_write_annotations.py b/test/test_write_annotations.py index 41abdfe3b..d98c96c15 100644 --- a/test/test_write_annotations.py +++ b/test/test_write_annotations.py @@ -15,11 +15,11 @@ import io import xml.etree.ElementTree -import youtube_dl.YoutubeDL -import youtube_dl.extractor +import youtube_dlc.YoutubeDL +import youtube_dlc.extractor -class YoutubeDL(youtube_dl.YoutubeDL): +class YoutubeDL(youtube_dlc.YoutubeDL): def __init__(self, *args, **kwargs): super(YoutubeDL, self).__init__(*args, **kwargs) self.to_stderr = self.to_screen @@ -45,7 +45,7 @@ class TestAnnotations(unittest.TestCase): def test_info_json(self): expected = list(EXPECTED_ANNOTATIONS) # Two annotations could have the same text. - ie = youtube_dl.extractor.YoutubeIE() + ie = youtube_dlc.extractor.YoutubeIE() ydl = YoutubeDL(params) ydl.add_info_extractor(ie) ydl.download([TEST_ID]) diff --git a/test/test_youtube_chapters.py b/test/test_youtube_chapters.py index e69c57377..4529d2e84 100644 --- a/test/test_youtube_chapters.py +++ b/test/test_youtube_chapters.py @@ -9,7 +9,7 @@ import unittest sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from test.helper import expect_value -from youtube_dl.extractor import YoutubeIE +from youtube_dlc.extractor import YoutubeIE class TestYoutubeChapters(unittest.TestCase): diff --git a/test/test_youtube_lists.py b/test/test_youtube_lists.py index c4f0abbea..a693963ef 100644 --- a/test/test_youtube_lists.py +++ b/test/test_youtube_lists.py @@ -10,7 +10,7 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from test.helper import FakeYDL -from youtube_dl.extractor import ( +from youtube_dlc.extractor import ( YoutubePlaylistIE, YoutubeIE, ) diff --git a/test/test_youtube_signature.py b/test/test_youtube_signature.py index 69df30eda..a54b36198 100644 --- a/test/test_youtube_signature.py +++ b/test/test_youtube_signature.py @@ -13,8 +13,8 @@ import re import string from test.helper import FakeYDL -from youtube_dl.extractor import YoutubeIE -from youtube_dl.compat import compat_str, compat_urlretrieve +from youtube_dlc.extractor import YoutubeIE +from youtube_dlc.compat import compat_str, compat_urlretrieve _TESTS = [ ( -- cgit v1.2.3 From 3867038a06bbd17d7d832d93495280b52c2f84f2 Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 2 Sep 2020 22:37:35 +0200 Subject: renaming issues resolved --- test/test_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test_utils.py b/test/test_utils.py index 663a34e07..80c06db7e 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -1388,8 +1388,8 @@ Line 1 self.assertEqual(caesar('ebg', 'acegik', -2), 'abc') def test_rot47(self): - self.assertEqual(rot47('youtube-dlc'), r'J@FEF36\5=') - self.assertEqual(rot47('youtube-dlc'), r'*~&%&qt\s{') + self.assertEqual(rot47('youtube-dlc'), r'J@FEF36\5=4') + self.assertEqual(rot47('youtube-dlc'), r'*~&%&qt\s{r') def test_urshift(self): self.assertEqual(urshift(3, 1), 1) -- cgit v1.2.3 From 8ef153ee6ff58ae3c2075d50a4a132e9ecd898b1 Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 2 Sep 2020 22:57:46 +0200 Subject: rot47 capital letters. --- test/test_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/test_utils.py b/test/test_utils.py index 80c06db7e..5914d4fd6 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -1389,7 +1389,7 @@ Line 1 def test_rot47(self): self.assertEqual(rot47('youtube-dlc'), r'J@FEF36\5=4') - self.assertEqual(rot47('youtube-dlc'), r'*~&%&qt\s{r') + self.assertEqual(rot47('YOUTUBE-DLC'), r'*~&%&qt\s{r') def test_urshift(self): self.assertEqual(urshift(3, 1), 1) -- cgit v1.2.3 From 8848f8083b23a48d07fa2edb95eee8c547b542d9 Mon Sep 17 00:00:00 2001 From: zubearc Date: Sat, 5 Sep 2020 17:54:19 -0400 Subject: [test/youtube] update subtitle tests --- test/test_subtitles.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/test_subtitles.py b/test/test_subtitles.py index 17aaaf20d..d9727c579 100644 --- a/test/test_subtitles.py +++ b/test/test_subtitles.py @@ -64,8 +64,8 @@ class TestYoutubeSubtitles(BaseTestSubtitles): self.DL.params['allsubtitles'] = True subtitles = self.getSubtitles() self.assertEqual(len(subtitles.keys()), 13) - self.assertEqual(md5(subtitles['en']), '3cb210999d3e021bd6c7f0ea751eab06') - self.assertEqual(md5(subtitles['it']), '6d752b98c31f1cf8d597050c7a2cb4b5') + self.assertEqual(md5(subtitles['en']), '688dd1ce0981683867e7fe6fde2a224b') + self.assertEqual(md5(subtitles['it']), '31324d30b8430b309f7f5979a504a769') for lang in ['fr', 'de']: self.assertTrue(subtitles.get(lang) is not None, 'Subtitles for \'%s\' not extracted' % lang) @@ -73,13 +73,13 @@ class TestYoutubeSubtitles(BaseTestSubtitles): self.DL.params['writesubtitles'] = True self.DL.params['subtitlesformat'] = 'ttml' subtitles = self.getSubtitles() - self.assertEqual(md5(subtitles['en']), 'e306f8c42842f723447d9f63ad65df54') + self.assertEqual(md5(subtitles['en']), 'c97ddf1217390906fa9fbd34901f3da2') def test_youtube_subtitles_vtt_format(self): self.DL.params['writesubtitles'] = True self.DL.params['subtitlesformat'] = 'vtt' subtitles = self.getSubtitles() - self.assertEqual(md5(subtitles['en']), '3cb210999d3e021bd6c7f0ea751eab06') + self.assertEqual(md5(subtitles['en']), 'ae1bd34126571a77aabd4d276b28044d') def test_youtube_automatic_captions(self): self.url = '8YoUxe5ncPo' @@ -88,9 +88,15 @@ class TestYoutubeSubtitles(BaseTestSubtitles): subtitles = self.getSubtitles() self.assertTrue(subtitles['it'] is not None) + def test_youtube_no_automatic_captions(self): + self.url = 'QRS8MkLhQmM' + self.DL.params['writeautomaticsub'] = True + subtitles = self.getSubtitles() + self.assertTrue(not subtitles) + def test_youtube_translated_subtitles(self): # This video has a subtitles track, which can be translated - self.url = 'Ky9eprVWzlI' + self.url = 'i0ZabxXmH4Y' self.DL.params['writeautomaticsub'] = True self.DL.params['subtitleslangs'] = ['it'] subtitles = self.getSubtitles() -- cgit v1.2.3 From 39e7107d7f4553d48e0172724729b0a8ef73d7ed Mon Sep 17 00:00:00 2001 From: Unknown Date: Sat, 12 Sep 2020 05:08:57 +0200 Subject: Merge branch 'ytdl-org-master' --- test/test_utils.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'test') diff --git a/test/test_utils.py b/test/test_utils.py index 5914d4fd6..95231200b 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -803,6 +803,8 @@ class TestUtil(unittest.TestCase): self.assertEqual(mimetype2ext('text/vtt'), 'vtt') self.assertEqual(mimetype2ext('text/vtt;charset=utf-8'), 'vtt') self.assertEqual(mimetype2ext('text/html; charset=utf-8'), 'html') + self.assertEqual(mimetype2ext('audio/x-wav'), 'wav') + self.assertEqual(mimetype2ext('audio/x-wav;codec=pcm'), 'wav') def test_month_by_name(self): self.assertEqual(month_by_name(None), None) -- cgit v1.2.3 From cdb7547e14e94dbbd66163fefe20fc367ba1474c Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 23 Sep 2020 03:30:33 +0200 Subject: add pyinst to test exceptions --- test/test_unicode_literals.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'test') diff --git a/test/test_unicode_literals.py b/test/test_unicode_literals.py index 6c1b7ec91..e6627a3e5 100644 --- a/test/test_unicode_literals.py +++ b/test/test_unicode_literals.py @@ -15,6 +15,8 @@ IGNORED_FILES = [ 'setup.py', # http://bugs.python.org/issue13943 'conf.py', 'buildserver.py', + 'pyinst.py', + 'pyinst32.py', ] IGNORED_DIRS = [ -- cgit v1.2.3 From dd2d55f10dac8b6cb5e8ab4b2cccb302655b40ea Mon Sep 17 00:00:00 2001 From: Unknown Date: Sat, 24 Oct 2020 05:09:22 +0200 Subject: COMPLAINFREE --- test/test_all_urls.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'test') diff --git a/test/test_all_urls.py b/test/test_all_urls.py index 7b6664cac..548bc6750 100644 --- a/test/test_all_urls.py +++ b/test/test_all_urls.py @@ -33,7 +33,6 @@ class TestAllURLsMatching(unittest.TestCase): assertPlaylist = lambda url: self.assertMatch(url, ['youtube:playlist']) assertPlaylist('ECUl4u3cNGP61MdtwGTqZA0MreSaDybji8') assertPlaylist('UUBABnxM4Ar9ten8Mdjj1j0Q') # 585 - assertPlaylist('PL63F0C78739B09958') assertPlaylist('https://www.youtube.com/playlist?list=UUBABnxM4Ar9ten8Mdjj1j0Q') assertPlaylist('https://www.youtube.com/course?list=ECUl4u3cNGP61MdtwGTqZA0MreSaDybji8') assertPlaylist('https://www.youtube.com/playlist?list=PLwP_SiAcdui0KVebT0mU9Apz359a4ubsC') @@ -70,7 +69,7 @@ class TestAllURLsMatching(unittest.TestCase): def test_youtube_search_matching(self): self.assertMatch('http://www.youtube.com/results?search_query=making+mustard', ['youtube:search_url']) - self.assertMatch('https://www.youtube.com/results?baz=bar&search_query=youtube-dlc+test+video&filters=video&lclk=video', ['youtube:search_url']) + self.assertMatch('https://www.youtube.com/results?baz=bar&search_query=youtube-dl+test+video&filters=video&lclk=video', ['youtube:search_url']) def test_youtube_extract(self): assertExtractId = lambda url, id: self.assertEqual(YoutubeIE.extract_id(url), id) -- cgit v1.2.3 From 8bdd16b4993b8d546b4cbbdbe4710db0bc2f971b Mon Sep 17 00:00:00 2001 From: pukkandan Date: Fri, 20 Nov 2020 00:52:59 +0530 Subject: Merge 'ytdl-org/youtube-dl/master' release 2020.11.19 Old Extractors left behind: VLivePlaylistIE YoutubeSearchURLIE YoutubeShowIE YoutubeFavouritesIE If removing old extractors, make corresponding changes in docs/supportedsites.md youtube_dlc/extractor/extractors.py Not merged: .github/ISSUE_TEMPLATE/1_broken_site.md .github/ISSUE_TEMPLATE/2_site_support_request.md .github/ISSUE_TEMPLATE/3_site_feature_request.md .github/ISSUE_TEMPLATE/4_bug_report.md .github/ISSUE_TEMPLATE/5_feature_request.md test/test_all_urls.py youtube_dlc/version.py Changelog --- test/test_all_urls.py | 26 ++++++++++++-------------- test/test_utils.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 14 deletions(-) (limited to 'test') diff --git a/test/test_all_urls.py b/test/test_all_urls.py index 548bc6750..a44cf7549 100644 --- a/test/test_all_urls.py +++ b/test/test_all_urls.py @@ -31,15 +31,17 @@ class TestAllURLsMatching(unittest.TestCase): def test_youtube_playlist_matching(self): assertPlaylist = lambda url: self.assertMatch(url, ['youtube:playlist']) + assertTab = lambda url: self.assertMatch(url, ['youtube:tab']) assertPlaylist('ECUl4u3cNGP61MdtwGTqZA0MreSaDybji8') assertPlaylist('UUBABnxM4Ar9ten8Mdjj1j0Q') # 585 - assertPlaylist('https://www.youtube.com/playlist?list=UUBABnxM4Ar9ten8Mdjj1j0Q') + assertPlaylist('PL63F0C78739B09958') + assertTab('https://www.youtube.com/playlist?list=UUBABnxM4Ar9ten8Mdjj1j0Q') assertPlaylist('https://www.youtube.com/course?list=ECUl4u3cNGP61MdtwGTqZA0MreSaDybji8') - assertPlaylist('https://www.youtube.com/playlist?list=PLwP_SiAcdui0KVebT0mU9Apz359a4ubsC') - assertPlaylist('https://www.youtube.com/watch?v=AV6J6_AeFEQ&playnext=1&list=PL4023E734DA416012') # 668 + assertTab('https://www.youtube.com/playlist?list=PLwP_SiAcdui0KVebT0mU9Apz359a4ubsC') + assertTab('https://www.youtube.com/watch?v=AV6J6_AeFEQ&playnext=1&list=PL4023E734DA416012') # 668 self.assertFalse('youtube:playlist' in self.matching_ies('PLtS2H6bU1M')) # Top tracks - assertPlaylist('https://www.youtube.com/playlist?list=MCUS.20142101') + assertTab('https://www.youtube.com/playlist?list=MCUS.20142101') def test_youtube_matching(self): self.assertTrue(YoutubeIE.suitable('PLtS2H6bU1M')) @@ -50,26 +52,22 @@ class TestAllURLsMatching(unittest.TestCase): self.assertMatch('http://www.cleanvideosearch.com/media/action/yt/watch?videoId=8v_4O44sfjM', ['youtube']) def test_youtube_channel_matching(self): - assertChannel = lambda url: self.assertMatch(url, ['youtube:channel']) + assertChannel = lambda url: self.assertMatch(url, ['youtube:tab']) assertChannel('https://www.youtube.com/channel/HCtnHdj3df7iM') assertChannel('https://www.youtube.com/channel/HCtnHdj3df7iM?feature=gb_ch_rec') assertChannel('https://www.youtube.com/channel/HCtnHdj3df7iM/videos') - def test_youtube_user_matching(self): - self.assertMatch('http://www.youtube.com/NASAgovVideo/videos', ['youtube:user']) + # def test_youtube_user_matching(self): + # self.assertMatch('http://www.youtube.com/NASAgovVideo/videos', ['youtube:tab']) def test_youtube_feeds(self): self.assertMatch('https://www.youtube.com/feed/watch_later', ['youtube:watchlater']) self.assertMatch('https://www.youtube.com/feed/subscriptions', ['youtube:subscriptions']) self.assertMatch('https://www.youtube.com/feed/recommended', ['youtube:recommended']) - self.assertMatch('https://www.youtube.com/my_favorites', ['youtube:favorites']) - def test_youtube_show_matching(self): - self.assertMatch('http://www.youtube.com/show/airdisasters', ['youtube:show']) - - def test_youtube_search_matching(self): - self.assertMatch('http://www.youtube.com/results?search_query=making+mustard', ['youtube:search_url']) - self.assertMatch('https://www.youtube.com/results?baz=bar&search_query=youtube-dl+test+video&filters=video&lclk=video', ['youtube:search_url']) + # def test_youtube_search_matching(self): + # self.assertMatch('http://www.youtube.com/results?search_query=making+mustard', ['youtube:search_url']) + # self.assertMatch('https://www.youtube.com/results?baz=bar&search_query=youtube-dl+test+video&filters=video&lclk=video', ['youtube:search_url']) def test_youtube_extract(self): assertExtractId = lambda url, id: self.assertEqual(YoutubeIE.extract_id(url), id) diff --git a/test/test_utils.py b/test/test_utils.py index 95231200b..16ad40831 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -937,6 +937,28 @@ class TestUtil(unittest.TestCase): self.assertEqual(d['x'], 1) self.assertEqual(d['y'], 'a') + # Just drop ! prefix for now though this results in a wrong value + on = js_to_json('''{ + a: !0, + b: !1, + c: !!0, + d: !!42.42, + e: !!![], + f: !"abc", + g: !"", + !42: 42 + }''') + self.assertEqual(json.loads(on), { + 'a': 0, + 'b': 1, + 'c': 0, + 'd': 42.42, + 'e': [], + 'f': "abc", + 'g': "", + '42': 42 + }) + on = js_to_json('["abc", "def",]') self.assertEqual(json.loads(on), ['abc', 'def']) @@ -994,6 +1016,12 @@ class TestUtil(unittest.TestCase): on = js_to_json('{42:4.2e1}') self.assertEqual(json.loads(on), {'42': 42.0}) + on = js_to_json('{ "0x40": "0x40" }') + self.assertEqual(json.loads(on), {'0x40': '0x40'}) + + on = js_to_json('{ "040": "040" }') + self.assertEqual(json.loads(on), {'040': '040'}) + def test_js_to_json_malformed(self): self.assertEqual(js_to_json('42a1'), '42"a1"') self.assertEqual(js_to_json('42a-1'), '42"a"-1') -- cgit v1.2.3 From 3462ffa8929d2a40588669578ca912d57a0da1bb Mon Sep 17 00:00:00 2001 From: pukkandan Date: Sun, 22 Nov 2020 03:51:09 +0530 Subject: Implemented all Youtube Feeds (ytfav, ytwatchlater, ytsubs, ythistory, ytrec) and SearchURL --- test/test_all_urls.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/test_all_urls.py b/test/test_all_urls.py index a44cf7549..4784c633f 100644 --- a/test/test_all_urls.py +++ b/test/test_all_urls.py @@ -35,6 +35,9 @@ class TestAllURLsMatching(unittest.TestCase): assertPlaylist('ECUl4u3cNGP61MdtwGTqZA0MreSaDybji8') assertPlaylist('UUBABnxM4Ar9ten8Mdjj1j0Q') # 585 assertPlaylist('PL63F0C78739B09958') + assertTab('https://www.youtube.com/AsapSCIENCE') + assertTab('https://www.youtube.com/embedded') + assertTab('https://www.youtube.com/feed') # Own channel's home page assertTab('https://www.youtube.com/playlist?list=UUBABnxM4Ar9ten8Mdjj1j0Q') assertPlaylist('https://www.youtube.com/course?list=ECUl4u3cNGP61MdtwGTqZA0MreSaDybji8') assertTab('https://www.youtube.com/playlist?list=PLwP_SiAcdui0KVebT0mU9Apz359a4ubsC') @@ -47,7 +50,7 @@ class TestAllURLsMatching(unittest.TestCase): self.assertTrue(YoutubeIE.suitable('PLtS2H6bU1M')) self.assertFalse(YoutubeIE.suitable('https://www.youtube.com/watch?v=AV6J6_AeFEQ&playnext=1&list=PL4023E734DA416012')) # 668 self.assertMatch('http://youtu.be/BaW_jenozKc', ['youtube']) - self.assertMatch('http://www.youtube.com/v/BaW_jenozKc', ['youtube']) + # self.assertMatch('http://www.youtube.com/v/BaW_jenozKc', ['youtube']) # /v/ is no longer valid self.assertMatch('https://youtube.googleapis.com/v/BaW_jenozKc', ['youtube']) self.assertMatch('http://www.cleanvideosearch.com/media/action/yt/watch?videoId=8v_4O44sfjM', ['youtube']) -- cgit v1.2.3 From a0566bbf5c3dea282447efb2926d71bafe1b7720 Mon Sep 17 00:00:00 2001 From: pukkandan Date: Sat, 21 Nov 2020 20:20:42 +0530 Subject: Updated to release 2020.11.21.1 --- test/parameters.json | 2 +- test/test_YoutubeDL.py | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/parameters.json b/test/parameters.json index 7bf59c25f..65fd54428 100644 --- a/test/parameters.json +++ b/test/parameters.json @@ -37,7 +37,7 @@ "writeinfojson": true, "writesubtitles": false, "allsubtitles": false, - "listssubtitles": false, + "listsubtitles": false, "socket_timeout": 20, "fixup": "never" } diff --git a/test/test_YoutubeDL.py b/test/test_YoutubeDL.py index 6d02c2a54..a9e649191 100644 --- a/test/test_YoutubeDL.py +++ b/test/test_YoutubeDL.py @@ -919,6 +919,76 @@ class TestYoutubeDL(unittest.TestCase): self.assertEqual(downloaded['extractor'], 'testex') self.assertEqual(downloaded['extractor_key'], 'TestEx') + # Test case for https://github.com/ytdl-org/youtube-dl/issues/27064 + def test_ignoreerrors_for_playlist_with_url_transparent_iterable_entries(self): + + class _YDL(YDL): + def __init__(self, *args, **kwargs): + super(_YDL, self).__init__(*args, **kwargs) + + def trouble(self, s, tb=None): + pass + + ydl = _YDL({ + 'format': 'extra', + 'ignoreerrors': True, + }) + + class VideoIE(InfoExtractor): + _VALID_URL = r'video:(?P\d+)' + + def _real_extract(self, url): + video_id = self._match_id(url) + formats = [{ + 'format_id': 'default', + 'url': 'url:', + }] + if video_id == '0': + raise ExtractorError('foo') + if video_id == '2': + formats.append({ + 'format_id': 'extra', + 'url': TEST_URL, + }) + return { + 'id': video_id, + 'title': 'Video %s' % video_id, + 'formats': formats, + } + + class PlaylistIE(InfoExtractor): + _VALID_URL = r'playlist:' + + def _entries(self): + for n in range(3): + video_id = compat_str(n) + yield { + '_type': 'url_transparent', + 'ie_key': VideoIE.ie_key(), + 'id': video_id, + 'url': 'video:%s' % video_id, + 'title': 'Video Transparent %s' % video_id, + } + + def _real_extract(self, url): + return self.playlist_result(self._entries()) + + ydl.add_info_extractor(VideoIE(ydl)) + ydl.add_info_extractor(PlaylistIE(ydl)) + info = ydl.extract_info('playlist:') + entries = info['entries'] + self.assertEqual(len(entries), 3) + self.assertTrue(entries[0] is None) + self.assertTrue(entries[1] is None) + self.assertEqual(len(ydl.downloaded_info_dicts), 1) + downloaded = ydl.downloaded_info_dicts[0] + self.assertEqual(entries[2], downloaded) + self.assertEqual(downloaded['url'], TEST_URL) + self.assertEqual(downloaded['title'], 'Video Transparent 2') + self.assertEqual(downloaded['id'], '2') + self.assertEqual(downloaded['extractor'], 'Video') + self.assertEqual(downloaded['extractor_key'], 'Video') + if __name__ == '__main__': unittest.main() -- cgit v1.2.3 From 3d3dddc94882c50f1c3ad15663bbd43cae7b0bea Mon Sep 17 00:00:00 2001 From: pukkandan Date: Tue, 24 Nov 2020 03:29:10 +0530 Subject: Update youtube extractor to 2020.11.24 --- test/test_all_urls.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/test_all_urls.py b/test/test_all_urls.py index 4784c633f..8dcdc4e58 100644 --- a/test/test_all_urls.py +++ b/test/test_all_urls.py @@ -64,9 +64,10 @@ class TestAllURLsMatching(unittest.TestCase): # self.assertMatch('http://www.youtube.com/NASAgovVideo/videos', ['youtube:tab']) def test_youtube_feeds(self): - self.assertMatch('https://www.youtube.com/feed/watch_later', ['youtube:watchlater']) - self.assertMatch('https://www.youtube.com/feed/subscriptions', ['youtube:subscriptions']) - self.assertMatch('https://www.youtube.com/feed/recommended', ['youtube:recommended']) + self.assertMatch('https://www.youtube.com/feed/library', ['youtube:tab']) + self.assertMatch('https://www.youtube.com/feed/history', ['youtube:tab']) + self.assertMatch('https://www.youtube.com/feed/watch_later', ['youtube:tab']) + self.assertMatch('https://www.youtube.com/feed/subscriptions', ['youtube:tab']) # def test_youtube_search_matching(self): # self.assertMatch('http://www.youtube.com/results?search_query=making+mustard', ['youtube:search_url']) -- cgit v1.2.3 From 732044afb2e8ffbaa37fe91310906ff549edd6ad Mon Sep 17 00:00:00 2001 From: pukkandan Date: Tue, 27 Oct 2020 16:07:21 +0530 Subject: Add --write-*-link by h-h-h-h Authored-by: h-h-h-h --- test/parameters.json | 5 +++++ test/test_YoutubeDL.py | 4 ++++ test/test_compat.py | 23 +++++++++++++++++++++++ test/test_utils.py | 27 +++++++++++++++++++++++++++ 4 files changed, 59 insertions(+) (limited to 'test') diff --git a/test/parameters.json b/test/parameters.json index 65fd54428..76c2a9ae7 100644 --- a/test/parameters.json +++ b/test/parameters.json @@ -35,6 +35,11 @@ "verbose": true, "writedescription": false, "writeinfojson": true, + "writeannotations": false, + "writelink": false, + "writeurllink": false, + "writewebloclink": false, + "writedesktoplink": false, "writesubtitles": false, "allsubtitles": false, "listsubtitles": false, diff --git a/test/test_YoutubeDL.py b/test/test_YoutubeDL.py index a9e649191..5950dbffc 100644 --- a/test/test_YoutubeDL.py +++ b/test/test_YoutubeDL.py @@ -42,6 +42,7 @@ def _make_result(formats, **kwargs): 'title': 'testttitle', 'extractor': 'testex', 'extractor_key': 'TestEx', + 'webpage_url': 'http://example.com/watch?v=shenanigans', } res.update(**kwargs) return res @@ -567,6 +568,7 @@ class TestYoutubeDL(unittest.TestCase): 'subtitles': subtitles, 'automatic_captions': auto_captions, 'extractor': 'TEST', + 'webpage_url': 'http://example.com/watch?v=shenanigans', } def get_info(params={}): @@ -730,6 +732,7 @@ class TestYoutubeDL(unittest.TestCase): 'playlist_id': '42', 'uploader': "變態妍字幕版 太妍 тест", 'creator': "тест ' 123 ' тест--", + 'webpage_url': 'http://example.com/watch?v=shenanigans', } second = { 'id': '2', @@ -741,6 +744,7 @@ class TestYoutubeDL(unittest.TestCase): 'filesize': 5 * 1024, 'playlist_id': '43', 'uploader': "тест 123", + 'webpage_url': 'http://example.com/watch?v=SHENANIGANS', } videos = [first, second] diff --git a/test/test_compat.py b/test/test_compat.py index 8c49a001e..f66739bd4 100644 --- a/test/test_compat.py +++ b/test/test_compat.py @@ -19,6 +19,8 @@ from youtube_dlc.compat import ( compat_shlex_split, compat_str, compat_struct_unpack, + compat_urllib_parse_quote, + compat_urllib_parse_quote_plus, compat_urllib_parse_unquote, compat_urllib_parse_unquote_plus, compat_urllib_parse_urlencode, @@ -53,6 +55,27 @@ class TestCompat(unittest.TestCase): dir(youtube_dlc.compat))) - set(['unicode_literals']) self.assertEqual(all_names, sorted(present_names)) + def test_compat_urllib_parse_quote(self): + self.assertEqual(compat_urllib_parse_quote('abc def'), 'abc%20def') + self.assertEqual(compat_urllib_parse_quote('/~user/abc+def'), '/%7Euser/abc%2Bdef') + self.assertEqual(compat_urllib_parse_quote('/~user/abc+def', safe='/~+'), '/~user/abc+def') + self.assertEqual(compat_urllib_parse_quote(''), '') + self.assertEqual(compat_urllib_parse_quote('%'), '%25') + self.assertEqual(compat_urllib_parse_quote('%', safe='%'), '%') + self.assertEqual(compat_urllib_parse_quote('津波'), '%E6%B4%A5%E6%B3%A2') + self.assertEqual( + compat_urllib_parse_quote(''' +%%a''', safe='<>=":%/ \r\n'), + ''' +%%a''') + self.assertEqual( + compat_urllib_parse_quote('''(^◣_◢^)っ︻デ═一 ⇀ ⇀ ⇀ ⇀ ⇀ ↶%I%Break%25Things%''', safe='% '), + '''%28%5E%E2%97%A3_%E2%97%A2%5E%29%E3%81%A3%EF%B8%BB%E3%83%87%E2%95%90%E4%B8%80 %E2%87%80 %E2%87%80 %E2%87%80 %E2%87%80 %E2%87%80 %E2%86%B6%I%Break%25Things%''') + + def test_compat_urllib_parse_quote_plus(self): + self.assertEqual(compat_urllib_parse_quote_plus('abc def'), 'abc+def') + self.assertEqual(compat_urllib_parse_quote_plus('~/abc def'), '%7E%2Fabc+def') + def test_compat_urllib_parse_unquote(self): self.assertEqual(compat_urllib_parse_unquote('abc%20def'), 'abc def') self.assertEqual(compat_urllib_parse_unquote('%7e/abc+def'), '~/abc+def') diff --git a/test/test_utils.py b/test/test_utils.py index 16ad40831..6562d443a 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -104,6 +104,7 @@ from youtube_dlc.utils import ( cli_valueless_option, cli_bool_option, parse_codecs, + iri_to_uri, ) from youtube_dlc.compat import ( compat_chr, @@ -1465,6 +1466,32 @@ Line 1 self.assertEqual(get_elements_by_attribute('class', 'foo', html), []) self.assertEqual(get_elements_by_attribute('class', 'no-such-foo', html), []) + def test_iri_to_uri(self): + self.assertEqual( + iri_to_uri('https://www.google.com/search?q=foo&ie=utf-8&oe=utf-8&client=firefox-b'), + 'https://www.google.com/search?q=foo&ie=utf-8&oe=utf-8&client=firefox-b') # Same + self.assertEqual( + iri_to_uri('https://www.google.com/search?q=Käsesoßenrührlöffel'), # German for cheese sauce stirring spoon + 'https://www.google.com/search?q=K%C3%A4seso%C3%9Fenr%C3%BChrl%C3%B6ffel') + self.assertEqual( + iri_to_uri('https://www.google.com/search?q=lt<+gt>+eq%3D+amp%26+percent%25+hash%23+colon%3A+tilde~#trash=?&garbage=#'), + 'https://www.google.com/search?q=lt%3C+gt%3E+eq%3D+amp%26+percent%25+hash%23+colon%3A+tilde~#trash=?&garbage=#') + self.assertEqual( + iri_to_uri('http://правозащита38.рф/category/news/'), + 'http://xn--38-6kcaak9aj5chl4a3g.xn--p1ai/category/news/') + self.assertEqual( + iri_to_uri('http://www.правозащита38.рф/category/news/'), + 'http://www.xn--38-6kcaak9aj5chl4a3g.xn--p1ai/category/news/') + self.assertEqual( + iri_to_uri('https://i❤.ws/emojidomain/👍👏🤝💪'), + 'https://xn--i-7iq.ws/emojidomain/%F0%9F%91%8D%F0%9F%91%8F%F0%9F%A4%9D%F0%9F%92%AA') + self.assertEqual( + iri_to_uri('http://日本語.jp/'), + 'http://xn--wgv71a119e.jp/') + self.assertEqual( + iri_to_uri('http://导航.中国/'), + 'http://xn--fet810g.xn--fiqs8s/') + if __name__ == '__main__': unittest.main() -- cgit v1.2.3 From 2d30509fc893f58cac77c25134a246ed9d76e7ed Mon Sep 17 00:00:00 2001 From: pukkandan Date: Thu, 5 Nov 2020 23:13:21 +0530 Subject: Add --force-download-archive by by h-h-h-h Authored-by: h-h-h-h --- test/parameters.json | 1 + 1 file changed, 1 insertion(+) (limited to 'test') diff --git a/test/parameters.json b/test/parameters.json index 76c2a9ae7..f8abed2dd 100644 --- a/test/parameters.json +++ b/test/parameters.json @@ -7,6 +7,7 @@ "forcethumbnail": false, "forcetitle": false, "forceurl": false, + "force_write_download_archive": false, "format": "best", "ignoreerrors": false, "listformats": null, -- cgit v1.2.3 From 29f7c58aafb25a094e267a8a3fb355e102e42792 Mon Sep 17 00:00:00 2001 From: pukkandan Date: Fri, 1 Jan 2021 17:56:37 +0530 Subject: Update to ytdl-2021.01.03 --- test/test_InfoExtractor.py | 61 ++++++++++++++++++++++++++++++++++++++++++++++ test/test_all_urls.py | 6 ++--- test/test_utils.py | 5 ++++ 3 files changed, 69 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/test_InfoExtractor.py b/test/test_InfoExtractor.py index bdd01e41a..22e3d26a7 100644 --- a/test/test_InfoExtractor.py +++ b/test/test_InfoExtractor.py @@ -98,6 +98,55 @@ class TestInfoExtractor(unittest.TestCase): self.assertRaises(RegexNotFoundError, ie._html_search_meta, 'z', html, None, fatal=True) self.assertRaises(RegexNotFoundError, ie._html_search_meta, ('z', 'x'), html, None, fatal=True) + def test_search_json_ld_realworld(self): + # https://github.com/ytdl-org/youtube-dl/issues/23306 + expect_dict( + self, + self.ie._search_json_ld(r'''''', None), + { + 'title': '1 On 1 With Kleio', + 'description': 'Kleio Valentien', + 'url': 'https://gvideo.eporner.com/xN49A1cT3eB/xN49A1cT3eB.mp4', + 'timestamp': 1449347075, + 'duration': 743.0, + 'view_count': 1120958, + 'width': 1920, + 'height': 1080, + }) + def test_download_json(self): uri = encode_data_uri(b'{"foo": "blah"}', 'application/json') self.assertEqual(self.ie._download_json(uri, None), {'foo': 'blah'}) @@ -108,6 +157,18 @@ class TestInfoExtractor(unittest.TestCase): self.assertEqual(self.ie._download_json(uri, None, fatal=False), None) def test_parse_html5_media_entries(self): + # inline video tag + expect_dict( + self, + self.ie._parse_html5_media_entries( + 'https://127.0.0.1/video.html', + r'