1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-10-30 22:25:19 +00:00

[niconico] Fix extraction of thumbnails and uploader (#3266)

This commit is contained in:
Lesmiscore (Naoya Ozaki)
2022-04-01 19:31:58 +09:00
committed by GitHub
parent e6f868a63c
commit 5d45484cc7
2 changed files with 19 additions and 6 deletions

View File

@@ -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')),