1
0
mirror of https://github.com/yt-dlp/yt-dlp synced 2025-12-17 14:45:42 +07:00

[compat] Split into sub-modules (#2173)

Authored by: fstirlitz, pukkandan
This commit is contained in:
felix
2022-02-04 14:37:02 +01:00
committed by pukkandan
parent 19a0394044
commit 77f9033095
11 changed files with 274 additions and 318 deletions

View File

@@ -7,7 +7,6 @@
import netrc
import os
import random
import re
import sys
import time
import xml.etree.ElementTree
@@ -20,13 +19,13 @@
compat_getpass,
compat_http_client,
compat_os_name,
compat_Pattern,
compat_str,
compat_urllib_error,
compat_urllib_parse_unquote,
compat_urllib_parse_urlencode,
compat_urllib_request,
compat_urlparse,
re,
)
from ..downloader import FileDownloader
from ..downloader.f4m import get_base_url, remove_encrypted_media
@@ -1198,7 +1197,7 @@ def _search_regex(self, pattern, string, name, default=NO_DEFAULT, fatal=True, f
"""
if string is None:
mobj = None
elif isinstance(pattern, (str, compat_Pattern)):
elif isinstance(pattern, (str, re.Pattern)):
mobj = re.search(pattern, string, flags)
else:
for p in pattern: