aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYen Chi Hsuan <yan12125@gmail.com>2015-10-18 17:11:55 +0800
committerYen Chi Hsuan <yan12125@gmail.com>2015-10-18 17:11:55 +0800
commit01d22d47039dedace1c5414c83e9fecfca41b5a5 (patch)
tree67c44547c6e4d72a16967e983a372afa1de88846
parent48aae2d2cf49843d0efa227fa393a0c783fc3c1e (diff)
downloadyoutube-dl-01d22d47039dedace1c5414c83e9fecfca41b5a5.tar.xz
[twitter] Use _download_xml
-rw-r--r--youtube_dl/extractor/twitter.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/youtube_dl/extractor/twitter.py b/youtube_dl/extractor/twitter.py
index b2fff73b9..37a9fd5fd 100644
--- a/youtube_dl/extractor/twitter.py
+++ b/youtube_dl/extractor/twitter.py
@@ -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,
}