diff options
author | Lesmiscore (Naoya Ozaki) <nao20010128@gmail.com> | 2022-04-01 19:31:58 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-01 19:31:58 +0900 |
commit | 5d45484cc762861f8fe59fa42d499db5a284c2c7 (patch) | |
tree | 6b6989f1df7beac3325711b9a21dcaeb61daf95f /yt_dlp/utils.py | |
parent | e6f868a63c15f576152733a1508f474b5e5bd1ef (diff) | |
download | hypervideo-pre-5d45484cc762861f8fe59fa42d499db5a284c2c7.tar.lz hypervideo-pre-5d45484cc762861f8fe59fa42d499db5a284c2c7.tar.xz hypervideo-pre-5d45484cc762861f8fe59fa42d499db5a284c2c7.zip |
[niconico] Fix extraction of thumbnails and uploader (#3266)
Diffstat (limited to 'yt_dlp/utils.py')
-rw-r--r-- | yt_dlp/utils.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/yt_dlp/utils.py b/yt_dlp/utils.py index a2fa29afe..ce918750d 100644 --- a/yt_dlp/utils.py +++ b/yt_dlp/utils.py @@ -2418,11 +2418,14 @@ def parse_count(s): return str_to_int(mobj.group(1)) -def parse_resolution(s): +def parse_resolution(s, *, lenient=False): if s is None: return {} - mobj = re.search(r'(?<![a-zA-Z0-9])(?P<w>\d+)\s*[xX×,]\s*(?P<h>\d+)(?![a-zA-Z0-9])', s) + if lenient: + mobj = re.search(r'(?P<w>\d+)\s*[xX×,]\s*(?P<h>\d+)', s) + else: + mobj = re.search(r'(?<![a-zA-Z0-9])(?P<w>\d+)\s*[xX×,]\s*(?P<h>\d+)(?![a-zA-Z0-9])', s) if mobj: return { 'width': int(mobj.group('w')), |