Merge branch 'master' of github.com:rg3/youtube-dl
authorPhilipp Hagemeister <phihag@phihag.de>
Tue, 21 Jan 2014 23:21:27 +0000 (00:21 +0100)
committerPhilipp Hagemeister <phihag@phihag.de>
Tue, 21 Jan 2014 23:21:27 +0000 (00:21 +0100)
Conflicts:
youtube_dl/extractor/mtv.py

1  2 
youtube_dl/extractor/mtv.py

index 32cfa36322bb23335b3baf32f138d04937f679c3,127fbeb4edde7fdcc7d76ac95ab67b09cb7823a7..af889a8afeb9f50169ceb3f59d9dee83c27fee65
@@@ -7,11 -6,11 +6,13 @@@ from .common import InfoExtracto
  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
  
@@@ -67,8 -65,8 +67,9 @@@ class MTVServicesInfoExtractor(InfoExtr
          mediagen_url = re.sub(r'&[^=]*?={.*?}(?=(&|$))', '', mediagen_url)
          if 'acceptMethods' not in mediagen_url:
              mediagen_url += '&acceptMethods=fms'
-         mediagen_page = self._download_webpage(mediagen_url, video_id,
-                                                'Downloading video urls')
++
+         mediagen_doc = self._download_xml(mediagen_url, video_id,
+             'Downloading video urls')
  
          description_node = itemdoc.find('description')
          if description_node is not None:
          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_page),
+             'formats': self._extract_video_formats(mediagen_doc),
              'id': video_id,
              'thumbnail': self._get_thumbnail_url(uri, itemdoc),
              'description': description,