self.assertEqual(sanitize_url('httpss://foo.bar'), 'https://foo.bar')
self.assertEqual(sanitize_url('rmtps://foo.bar'), 'rtmps://foo.bar')
self.assertEqual(sanitize_url('https://foo.bar'), 'https://foo.bar')
+ self.assertEqual(sanitize_url('foo bar'), 'foo bar')
def test_expand_path(self):
def env(var):
'height': 720,
'age_limit': 18,
},
+ }, {
+ # would like to use the yt-dl test video but searching for
+ # '"\'/\\รคโญ๐' fails, so using an old vid from YouTube Korea
+ 'note': 'Test default search',
+ 'url': 'Shorts๋ก ํ๋ฝ ํ์์์ด ๋์! (BTSํธ)',
+ 'info_dict': {
+ 'id': 'usDGO4Zb-dc',
+ 'ext': 'mp4',
+ 'title': 'YouTube Shorts๋ก ํ๋ฝ ํ์์์ด ๋์! (BTSํธ)',
+ 'description': 'md5:96e31607eba81ab441567b5e289f4716',
+ 'upload_date': '20211107',
+ 'uploader': 'YouTube Korea',
+ 'location': '๋ํ๋ฏผ๊ตญ',
+ },
+ 'params': {
+ 'default_search': 'ytsearch',
+ 'skip_download': True,
+ },
+ 'expected_warnings': ['uploader id'],
},
]
for mistake, fixup in COMMON_TYPOS:
if re.match(mistake, url):
return re.sub(mistake, fixup, url)
- return escape_url(url)
+ return url
def sanitized_Request(url, *args, **kwargs):
- return compat_urllib_request.Request(sanitize_url(url), *args, **kwargs)
+ return compat_urllib_request.Request(escape_url(sanitize_url(url)), *args, **kwargs)
def expand_path(s):