[twitter] Use _download_xml
authorYen Chi Hsuan <yan12125@gmail.com>
Sun, 18 Oct 2015 09:11:55 +0000 (17:11 +0800)
committerYen Chi Hsuan <yan12125@gmail.com>
Sun, 18 Oct 2015 09:11:55 +0000 (17:11 +0800)
youtube_dl/extractor/twitter.py

index b2fff73b94bb8403550816cd100a0ceb792cba8e..37a9fd5fdf7fcfb79b17063c298aedcd017bdfc7 100644 (file)
@@ -8,6 +8,7 @@ from ..compat import compat_urllib_request
 from ..utils import (
     float_or_none,
     unescapeHTML,
+    xpath_text,
 )
 
 
@@ -60,9 +61,8 @@ class TwitterCardIE(InfoExtractor):
                 video_id)
             if 'playlist' not in config:
                 if 'vmapUrl' in config:
-                    webpage = self._download_webpage(config['vmapUrl'], video_id + ' (xml)')
-                    video_url = self._search_regex(
-                        r'<MediaFile>\s*<!\[CDATA\[(https?://.+?)\]\]>', webpage, 'data player config (xml)')
+                    vmap_data = self._download_xml(config['vmapUrl'], video_id)
+                    video_url = xpath_text(vmap_data, './/MediaFile').strip()
                     f = {
                         'url': video_url,
                     }