projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9250181
)
[extractor/common] Simplify _extract_m3u8_formats
author
Sergey M․
<dstftw@gmail.com>
Thu, 1 Sep 2016 15:18:16 +0000
(22:18 +0700)
committer
Sergey M․
<dstftw@gmail.com>
Thu, 1 Sep 2016 15:18:16 +0000
(22:18 +0700)
youtube_dl/extractor/common.py
patch
|
blob
|
history
diff --git
a/youtube_dl/extractor/common.py
b/youtube_dl/extractor/common.py
index 36d43fd50f03ffb099bf8f79b0047a51795960c4..a9c7a8d164d7e7b126eccc78a23462b44dfb96ac 100644
(file)
--- a/
youtube_dl/extractor/common.py
+++ b/
youtube_dl/extractor/common.py
@@
-1201,8
+1201,8
@@
class InfoExtractor(object):
'protocol': entry_protocol,
'preference': preference,
}]
'protocol': entry_protocol,
'preference': preference,
}]
- last_info =
None
- last_media =
None
+ last_info =
{}
+ last_media =
{}
for line in m3u8_doc.splitlines():
if line.startswith('#EXT-X-STREAM-INF:'):
last_info = parse_m3u8_attributes(line)
for line in m3u8_doc.splitlines():
if line.startswith('#EXT-X-STREAM-INF:'):
last_info = parse_m3u8_attributes(line)
@@
-1232,17
+1232,13
@@
class InfoExtractor(object):
elif line.startswith('#') or not line.strip():
continue
else:
elif line.startswith('#') or not line.strip():
continue
else:
- if last_info is None:
- formats.append({'url': format_url(line)})
- continue
tbr = int_or_none(last_info.get('AVERAGE-BANDWIDTH') or last_info.get('BANDWIDTH'), scale=1000)
format_id = []
if m3u8_id:
format_id.append(m3u8_id)
tbr = int_or_none(last_info.get('AVERAGE-BANDWIDTH') or last_info.get('BANDWIDTH'), scale=1000)
format_id = []
if m3u8_id:
format_id.append(m3u8_id)
- last_media_name = last_media.get('NAME') if last_media else None
# Despite specification does not mention NAME attribute for
# EXT-X-STREAM-INF it still sometimes may be present
# Despite specification does not mention NAME attribute for
# EXT-X-STREAM-INF it still sometimes may be present
- stream_name = last_info.get('NAME') or last_media
_name
+ stream_name = last_info.get('NAME') or last_media
.get('NAME')
# Bandwidth of live streams may differ over time thus making
# format_id unpredictable. So it's better to keep provided
# format_id intact.
# Bandwidth of live streams may differ over time thus making
# format_id unpredictable. So it's better to keep provided
# format_id intact.
@@
-1275,6
+1271,7
@@
class InfoExtractor(object):
f.update(parse_codecs(last_info.get('CODECS')))
formats.append(f)
last_info = {}
f.update(parse_codecs(last_info.get('CODECS')))
formats.append(f)
last_info = {}
+ last_media = {}
return formats
@staticmethod
return formats
@staticmethod