diff options
author | remitamine <remitamine@gmail.com> | 2016-02-19 20:56:45 +0100 |
---|---|---|
committer | remitamine <remitamine@gmail.com> | 2016-02-19 20:56:45 +0100 |
commit | 04cbc4980dcc35ce19c5b75222481f0839b74e98 (patch) | |
tree | f859839586c2f95a7f069e000dbe24114fefdef6 /youtube_dl/extractor | |
parent | 8765151c8a026f1c57ed239bae15a443339572e3 (diff) |
[mtv] imporove duration extraction
Diffstat (limited to 'youtube_dl/extractor')
-rw-r--r-- | youtube_dl/extractor/mtv.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/youtube_dl/extractor/mtv.py b/youtube_dl/extractor/mtv.py index 56ddcbbf3..ed068365d 100644 --- a/youtube_dl/extractor/mtv.py +++ b/youtube_dl/extractor/mtv.py @@ -111,7 +111,8 @@ class MTVServicesInfoExtractor(InfoExtractor): uri = itemdoc.find('guid').text video_id = self._id_from_uri(uri) self.report_extraction(video_id) - mediagen_url = itemdoc.find('%s/%s' % (_media_xml_tag('group'), _media_xml_tag('content'))).attrib['url'] + content_el = itemdoc.find('%s/%s' % (_media_xml_tag('group'), _media_xml_tag('content'))) + mediagen_url = content_el.attrib['url'] # Remove the templates, like &device={device} mediagen_url = re.sub(r'&[^=]*?={.*?}(?=(&|$))', '', mediagen_url) if 'acceptMethods' not in mediagen_url: @@ -159,9 +160,6 @@ class MTVServicesInfoExtractor(InfoExtractor): if mtvn_id_node is not None: mtvn_id = mtvn_id_node.text - content_el = find_xpath_attr(itemdoc, self._xpath_ns('.//content', 'http://search.yahoo.com/mrss/'), 'duration') - duration = float_or_none(content_el.attrib.get('duration')) if content_el is not None else None - return { 'title': title, 'formats': self._extract_video_formats(mediagen_doc, mtvn_id), @@ -169,7 +167,7 @@ class MTVServicesInfoExtractor(InfoExtractor): 'id': video_id, 'thumbnail': self._get_thumbnail_url(uri, itemdoc), 'description': description, - 'duration': duration, + 'duration': float_or_none(content_el.attrib.get('duration')), } def _get_feed_query(self, uri): |