X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2Fextractor%2Ftwentyfourvideo.py;h=4025edf02b4ca5b8c42e3324fb094fe43141ce68;hb=a6571f1073eab6c9a4cc9800a0bff31cf12fe09f;hp=cb9e5f1b5ccfbf64d90c6bee96d26c548c4379d7;hpb=747b028412828c66080c7f165b461a7ea490fead;p=youtube-dl
diff --git a/youtube_dl/extractor/twentyfourvideo.py b/youtube_dl/extractor/twentyfourvideo.py
index cb9e5f1b5..4025edf02 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,
)
@@ -15,7 +17,7 @@ class TwentyFourVideoIE(InfoExtractor):
_TESTS = [
{
'url': 'http://www.24video.net/video/view/1044982',
- 'md5': 'd041af8b5b4246ea466226a0d6693345',
+ 'md5': 'e09fc0901d9eaeedac872f154931deeb',
'info_dict': {
'id': '1044982',
'ext': 'mp4',
@@ -45,7 +47,8 @@ class TwentyFourVideoIE(InfoExtractor):
title = self._og_search_title(webpage)
description = self._html_search_regex(
- r'([^<]+)', webpage, 'description', fatal=False)
+ r'<(p|span)[^>]+itemprop="description"[^>]*>(?P[^<]+)\1>',
+ webpage, 'description', fatal=False, group='description')
thumbnail = self._og_search_thumbnail(webpage)
duration = int_or_none(self._og_search_property(
'duration', webpage, 'duration', fatal=False))
@@ -69,12 +72,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'))