mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-27 10:31:29 +00:00
[test_InfoExtractor] Add m3u8 parsing test for NAME attribute in EXT-X-STREAM-INF tag
This commit is contained in:
parent
07ad0cf34f
commit
ddd258f922
|
@ -361,7 +361,7 @@ def test_parse_m3u8_formats(self):
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'format_id': '155',
|
'format_id': '155',
|
||||||
'protocol': 'm3u8',
|
'protocol': 'm3u8',
|
||||||
'tbr': 155,
|
'tbr': 155.648,
|
||||||
'width': 320,
|
'width': 320,
|
||||||
'height': 180,
|
'height': 180,
|
||||||
}, {
|
}, {
|
||||||
|
@ -370,7 +370,7 @@ def test_parse_m3u8_formats(self):
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'format_id': '502',
|
'format_id': '502',
|
||||||
'protocol': 'm3u8',
|
'protocol': 'm3u8',
|
||||||
'tbr': 502,
|
'tbr': 502.784,
|
||||||
'width': 480,
|
'width': 480,
|
||||||
'height': 270,
|
'height': 270,
|
||||||
}, {
|
}, {
|
||||||
|
@ -379,7 +379,7 @@ def test_parse_m3u8_formats(self):
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'format_id': '827',
|
'format_id': '827',
|
||||||
'protocol': 'm3u8',
|
'protocol': 'm3u8',
|
||||||
'tbr': 827,
|
'tbr': 827.392,
|
||||||
'width': 640,
|
'width': 640,
|
||||||
'height': 360,
|
'height': 360,
|
||||||
}, {
|
}, {
|
||||||
|
@ -388,7 +388,7 @@ def test_parse_m3u8_formats(self):
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'format_id': '1396',
|
'format_id': '1396',
|
||||||
'protocol': 'm3u8',
|
'protocol': 'm3u8',
|
||||||
'tbr': 1396,
|
'tbr': 1396.736,
|
||||||
'width': 854,
|
'width': 854,
|
||||||
'height': 480,
|
'height': 480,
|
||||||
}]
|
}]
|
||||||
|
@ -413,7 +413,7 @@ def test_parse_m3u8_formats(self):
|
||||||
'protocol': 'm3u8',
|
'protocol': 'm3u8',
|
||||||
'acodec': 'mp4a.40.2',
|
'acodec': 'mp4a.40.2',
|
||||||
'vcodec': 'none',
|
'vcodec': 'none',
|
||||||
'tbr': 182,
|
'tbr': 182.725,
|
||||||
}, {
|
}, {
|
||||||
'url': 'https://vod.edgecast.hls.ttvnw.net/e5da31ab49_riotgames_15001215120_261543898/mobile/index-muted-HM49I092CC.m3u8',
|
'url': 'https://vod.edgecast.hls.ttvnw.net/e5da31ab49_riotgames_15001215120_261543898/mobile/index-muted-HM49I092CC.m3u8',
|
||||||
'manifest_url': 'https://vod.edgecast.hls.ttvnw.net/e5da31ab49_riotgames_15001215120_261543898/mobile/index-muted-HM49I092CC.m3u8',
|
'manifest_url': 'https://vod.edgecast.hls.ttvnw.net/e5da31ab49_riotgames_15001215120_261543898/mobile/index-muted-HM49I092CC.m3u8',
|
||||||
|
@ -422,7 +422,7 @@ def test_parse_m3u8_formats(self):
|
||||||
'protocol': 'm3u8',
|
'protocol': 'm3u8',
|
||||||
'acodec': 'mp4a.40.2',
|
'acodec': 'mp4a.40.2',
|
||||||
'vcodec': 'avc1.42C00D',
|
'vcodec': 'avc1.42C00D',
|
||||||
'tbr': 280,
|
'tbr': 280.474,
|
||||||
'width': 400,
|
'width': 400,
|
||||||
'height': 226,
|
'height': 226,
|
||||||
}, {
|
}, {
|
||||||
|
@ -433,7 +433,7 @@ def test_parse_m3u8_formats(self):
|
||||||
'protocol': 'm3u8',
|
'protocol': 'm3u8',
|
||||||
'acodec': 'mp4a.40.2',
|
'acodec': 'mp4a.40.2',
|
||||||
'vcodec': 'avc1.42C01E',
|
'vcodec': 'avc1.42C01E',
|
||||||
'tbr': 628,
|
'tbr': 628.347,
|
||||||
'width': 640,
|
'width': 640,
|
||||||
'height': 360,
|
'height': 360,
|
||||||
}, {
|
}, {
|
||||||
|
@ -444,7 +444,7 @@ def test_parse_m3u8_formats(self):
|
||||||
'protocol': 'm3u8',
|
'protocol': 'm3u8',
|
||||||
'acodec': 'mp4a.40.2',
|
'acodec': 'mp4a.40.2',
|
||||||
'vcodec': 'avc1.42C01E',
|
'vcodec': 'avc1.42C01E',
|
||||||
'tbr': 893,
|
'tbr': 893.387,
|
||||||
'width': 852,
|
'width': 852,
|
||||||
'height': 480,
|
'height': 480,
|
||||||
}, {
|
}, {
|
||||||
|
@ -455,7 +455,7 @@ def test_parse_m3u8_formats(self):
|
||||||
'protocol': 'm3u8',
|
'protocol': 'm3u8',
|
||||||
'acodec': 'mp4a.40.2',
|
'acodec': 'mp4a.40.2',
|
||||||
'vcodec': 'avc1.42C01F',
|
'vcodec': 'avc1.42C01F',
|
||||||
'tbr': 1603,
|
'tbr': 1603.789,
|
||||||
'width': 1280,
|
'width': 1280,
|
||||||
'height': 720,
|
'height': 720,
|
||||||
}, {
|
}, {
|
||||||
|
@ -466,7 +466,50 @@ def test_parse_m3u8_formats(self):
|
||||||
'protocol': 'm3u8',
|
'protocol': 'm3u8',
|
||||||
'acodec': 'mp4a.40.2',
|
'acodec': 'mp4a.40.2',
|
||||||
'vcodec': 'avc1.100.31',
|
'vcodec': 'avc1.100.31',
|
||||||
'tbr': 3214,
|
'tbr': 3214.134,
|
||||||
|
'width': 1280,
|
||||||
|
'height': 720,
|
||||||
|
}]
|
||||||
|
),
|
||||||
|
(
|
||||||
|
# http://www.vidio.com/watch/165683-dj_ambred-booyah-live-2015
|
||||||
|
# EXT-X-STREAM-INF tag with NAME attribute that is not defined
|
||||||
|
# in HLS specification
|
||||||
|
'vidio',
|
||||||
|
'https://www.vidio.com/videos/165683/playlist.m3u8',
|
||||||
|
[{
|
||||||
|
'url': 'https://www.vidio.com/videos/165683/playlist.m3u8',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'format_id': 'meta',
|
||||||
|
'format_note': 'Quality selection URL',
|
||||||
|
'protocol': 'm3u8',
|
||||||
|
'preference': -100,
|
||||||
|
'resolution': 'multiple'
|
||||||
|
}, {
|
||||||
|
'url': 'https://cdn1-a.production.vidio.static6.com/uploads/165683/dj_ambred-4383-b300.mp4.m3u8',
|
||||||
|
'manifest_url': 'https://cdn1-a.production.vidio.static6.com/uploads/165683/dj_ambred-4383-b300.mp4.m3u8',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'format_id': '270p 3G',
|
||||||
|
'protocol': 'm3u8',
|
||||||
|
'tbr': 300,
|
||||||
|
'width': 480,
|
||||||
|
'height': 270,
|
||||||
|
}, {
|
||||||
|
'url': 'https://cdn1-a.production.vidio.static6.com/uploads/165683/dj_ambred-4383-b600.mp4.m3u8',
|
||||||
|
'manifest_url': 'https://cdn1-a.production.vidio.static6.com/uploads/165683/dj_ambred-4383-b600.mp4.m3u8',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'format_id': '360p SD',
|
||||||
|
'protocol': 'm3u8',
|
||||||
|
'tbr': 600,
|
||||||
|
'width': 640,
|
||||||
|
'height': 360,
|
||||||
|
}, {
|
||||||
|
'url': 'https://cdn1-a.production.vidio.static6.com/uploads/165683/dj_ambred-4383-b1200.mp4.m3u8',
|
||||||
|
'manifest_url': 'https://cdn1-a.production.vidio.static6.com/uploads/165683/dj_ambred-4383-b1200.mp4.m3u8',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'format_id': '720p HD',
|
||||||
|
'protocol': 'm3u8',
|
||||||
|
'tbr': 1200,
|
||||||
'width': 1280,
|
'width': 1280,
|
||||||
'height': 720,
|
'height': 720,
|
||||||
}]
|
}]
|
||||||
|
|
|
@ -1397,7 +1397,9 @@ def extract_media(x_media_line):
|
||||||
|
|
||||||
def build_stream_name():
|
def build_stream_name():
|
||||||
# Despite specification does not mention NAME attribute for
|
# Despite specification does not mention NAME attribute for
|
||||||
# EXT-X-STREAM-INF it still sometimes may be present
|
# EXT-X-STREAM-INF tag (see [1] or vidio test in
|
||||||
|
# test_parse_m3u8_formats) it still sometimes may be present
|
||||||
|
# 1. http://www.vidio.com/watch/165683-dj_ambred-booyah-live-2015
|
||||||
stream_name = last_stream_inf.get('NAME')
|
stream_name = last_stream_inf.get('NAME')
|
||||||
if stream_name:
|
if stream_name:
|
||||||
return stream_name
|
return stream_name
|
||||||
|
|
Loading…
Reference in a new issue