summary refs log tree commit diff
diff options
context:
space:
mode:
authorremitamine <remitamine@gmail.com>2016-02-09 20:05:39 +0100
committerremitamine <remitamine@gmail.com>2016-02-09 20:05:39 +0100
commit51e9094f4a769187b11621c6477b19ad0e2418f9 (patch)
treebf8508cc63b999226aa2f1d7f6e7d52881028dd1
parent5e3a6fec3397e729991f360a4af9e2dd1e91d45c (diff)
downloadyoutube-dl-51e9094f4a769187b11621c6477b19ad0e2418f9.tar.gz
youtube-dl-51e9094f4a769187b11621c6477b19ad0e2418f9.tar.xz
youtube-dl-51e9094f4a769187b11621c6477b19ad0e2418f9.zip
[extractor/common] extract youtube dash formats filesize(fixes #8480)
-rw-r--r--youtube_dl/extractor/common.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py
index 1143f6dbb..a9497851c 100644
--- a/youtube_dl/extractor/common.py
+++ b/youtube_dl/extractor/common.py
@@ -1440,6 +1440,8 @@ class InfoExtractor(object):
                             base_url = mpd_base_url + base_url
                         representation_id = representation_attrib.get('id')
                         lang = representation_attrib.get('lang')
+                        url_el = representation.find(_add_ns('BaseURL'))
+                        filesize = int_or_none(url_el.attrib.get('{http://youtube.com/yt/2012/10/10}contentLength') if url_el is not None else None)
                         f = {
                             'format_id': mpd_id or representation_id,
                             'url': base_url,
@@ -1452,6 +1454,7 @@ class InfoExtractor(object):
                             'acodec': 'none' if content_type == 'video' else representation_attrib.get('codecs'),
                             'language': lang if lang not in ('mul', 'und', 'zxx', 'mis') else None,
                             'format_note': 'DASH %s' % content_type,
+                            'filesize': filesize,
                         }
                         representation_ms_info = extract_multisegment_info(representation, adaption_set_ms_info)
                         if 'segment_urls' not in representation_ms_info and 'media_template' in representation_ms_info: