1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-01-24 13:05:34 +08:00

Fixes according to suggestions

This commit is contained in:
Martin Hartkorn 2017-09-17 11:56:46 +02:00
parent c73c244203
commit 1ff963a230

View File

@ -41,18 +41,17 @@ class PietsmietIE(OnceIE):
m3u8_manifest_url, page_id, 'mp4', 'm3u8_native', m3u8_manifest_url, page_id, 'mp4', 'm3u8_native',
m3u8_id='hls') m3u8_id='hls')
# Give reproducible names for HLS formats instead of hls-<bitrate>
for f in m3u8_formats:
f['format_id'] = 'hls-{}p'.format(f['height'])
formats.extend(m3u8_formats) formats.extend(m3u8_formats)
if len(data_video['sources']) > 1: if len(data_video['sources']) > 1:
http_video = data_video['sources'][1] http_video = data_video['sources'][1]
label = http_video.get('label')
if label:
# Calculate resolution for HTTP format but should always be 1280x720 # Calculate resolution for HTTP format but should always be 1280x720
format_height_raw = self._search_regex( format_height_raw = self._search_regex(
'([0-9]+)p', http_video['label'], 'http video height', '([0-9]+)p', label, 'http video height',
default=720, fatal=False) default=720, fatal=False)
format_height = int_or_none(format_height_raw) format_height = int_or_none(format_height_raw)
@ -60,13 +59,19 @@ class PietsmietIE(OnceIE):
format_width = float(format_height) * (16 / 9) format_width = float(format_height) * (16 / 9)
formats.append({ formats.append({
'url': "https:{}".format(http_video['file']), 'url': "https:{0}".format(http_video['file']),
'ext': http_video['type'], 'ext': http_video.get('type'),
'format_id': 'http-{}'.format(http_video['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:
formats.append({
'url': "https:{0}".format(http_video['file']),
'ext': http_video.get('type'),
'fps': 30.0,
})
self._sort_formats(formats) self._sort_formats(formats)
@ -75,5 +80,5 @@ class PietsmietIE(OnceIE):
'display_id': page_id, 'display_id': page_id,
'title': compat_urllib_parse_unquote(data_video['abouttext']), 'title': compat_urllib_parse_unquote(data_video['abouttext']),
'formats': formats, 'formats': formats,
'thumbnail': 'http://www.pietsmiet.de/{}'.format(data_video.get('image')), 'thumbnail': 'http://www.pietsmiet.de/{0}'.format(data_video.get('image')),
} }