1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-01-24 04:42:52 +08:00

Allow formats with labels that don't match regex ([0-9]+)p

This commit is contained in:
Martin Hartkorn 2017-10-13 19:44:27 +02:00
parent 1ff963a230
commit 51285bd7c7

View File

@ -47,6 +47,7 @@ class PietsmietIE(OnceIE):
http_video = data_video['sources'][1] http_video = data_video['sources'][1]
label = http_video.get('label') label = http_video.get('label')
format_height = 0
if label: if label:
# Calculate resolution for HTTP format but should always be 1280x720 # Calculate resolution for HTTP format but should always be 1280x720
@ -55,17 +56,17 @@ class PietsmietIE(OnceIE):
default=720, fatal=False) default=720, fatal=False)
format_height = int_or_none(format_height_raw) format_height = int_or_none(format_height_raw)
if format_height: if format_height > 0:
format_width = float(format_height) * (16 / 9) format_width = float(format_height) * (16 / 9)
formats.append({ formats.append({
'url': "https:{0}".format(http_video['file']), 'url': "https:{0}".format(http_video['file']),
'ext': http_video.get('type'), 'ext': http_video.get('type'),
'format_id': 'http-{0}'.format(label), 'format_id': 'http-{0}'.format(label),
'width': int_or_none(format_width), 'width': int_or_none(format_width),
'height': format_height, 'height': format_height,
'fps': 30.0, 'fps': 30.0,
}) })
else: else:
formats.append({ formats.append({
'url': "https:{0}".format(http_video['file']), 'url': "https:{0}".format(http_video['file']),