aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/mtv.py
diff options
context:
space:
mode:
Diffstat (limited to 'youtube_dl/extractor/mtv.py')
-rw-r--r--youtube_dl/extractor/mtv.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/youtube_dl/extractor/mtv.py b/youtube_dl/extractor/mtv.py
index 127fbeb4e..af889a8af 100644
--- a/youtube_dl/extractor/mtv.py
+++ b/youtube_dl/extractor/mtv.py
@@ -6,11 +6,13 @@ from .common import InfoExtractor
from ..utils import (
compat_urllib_parse,
ExtractorError,
+ find_xpath_attr,
fix_xml_ampersands,
url_basename,
RegexNotFoundError,
)
+
def _media_xml_tag(tag):
return '{http://search.yahoo.com/mrss/}%s' % tag
@@ -65,6 +67,7 @@ class MTVServicesInfoExtractor(InfoExtractor):
mediagen_url = re.sub(r'&[^=]*?={.*?}(?=(&|$))', '', mediagen_url)
if 'acceptMethods' not in mediagen_url:
mediagen_url += '&acceptMethods=fms'
+
mediagen_doc = self._download_xml(mediagen_url, video_id,
'Downloading video urls')
@@ -74,8 +77,21 @@ class MTVServicesInfoExtractor(InfoExtractor):
else:
description = None
+ title_el = None
+ if title_el is None:
+ title_el = find_xpath_attr(
+ itemdoc, './/{http://search.yahoo.com/mrss/}category',
+ 'scheme', 'urn:mtvn:video_title')
+ if title_el is None:
+ title_el = itemdoc.find('.//{http://search.yahoo.com/mrss/}title')
+ if title_el is None:
+ title_el = itemdoc.find('.//title')
+ title = title_el.text
+ if title is None:
+ raise ExtractorError('Could not find video title')
+
return {
- 'title': itemdoc.find('title').text,
+ 'title': title,
'formats': self._extract_video_formats(mediagen_doc),
'id': video_id,
'thumbnail': self._get_thumbnail_url(uri, itemdoc),