about summary refs log tree commit diff
path: root/youtube_dl/extractor/twentyfourvideo.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2015-12-23 20:49:41 +0600
committerSergey M․ <dstftw@gmail.com>2015-12-23 20:49:41 +0600
commit128eb31d90583113083ba1fe329eb4cf42c2989f (patch)
tree3e07e0dcff998cf6781f8801ae3d2f893f61df1e /youtube_dl/extractor/twentyfourvideo.py
parent747b028412828c66080c7f165b461a7ea490fead (diff)
downloadyoutube-dl-128eb31d90583113083ba1fe329eb4cf42c2989f.tar.gz
youtube-dl-128eb31d90583113083ba1fe329eb4cf42c2989f.tar.xz
youtube-dl-128eb31d90583113083ba1fe329eb4cf42c2989f.zip
[24video] Fix extraction on python 2.6
Diffstat (limited to 'youtube_dl/extractor/twentyfourvideo.py')
-rw-r--r--youtube_dl/extractor/twentyfourvideo.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/youtube_dl/extractor/twentyfourvideo.py b/youtube_dl/extractor/twentyfourvideo.py
index cb9e5f1b5..68e2277a4 100644
--- a/youtube_dl/extractor/twentyfourvideo.py
+++ b/youtube_dl/extractor/twentyfourvideo.py
@@ -5,6 +5,8 @@ from .common import InfoExtractor
 from ..utils import (
     parse_iso8601,
     int_or_none,
+    xpath_attr,
+    xpath_element,
 )
 
 
@@ -69,12 +71,14 @@ class TwentyFourVideoIE(InfoExtractor):
             r'http://www.24video.net/video/xml/%s?mode=init' % video_id,
             video_id, 'Downloading init XML')
 
-        video = self._download_xml(
+        video_xml = self._download_xml(
             'http://www.24video.net/video/xml/%s?mode=play' % video_id,
-            video_id, 'Downloading video XML').find('.//video')
+            video_id, 'Downloading video XML')
+
+        video = xpath_element(video_xml, './/video', 'video', fatal=True)
 
         formats = [{
-            'url': video.attrib['url'],
+            'url': xpath_attr(video, '', 'url', 'video URL', fatal=True),
         }]
 
         like_count = int_or_none(video.get('ratingPlus'))