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:42:36 +0600
committerSergey M․ <dstftw@gmail.com>2015-12-23 20:42:36 +0600
commit747b028412828c66080c7f165b461a7ea490fead (patch)
tree90eff663073a65a2c0b1b968b3dd6a30706ea8a4 /youtube_dl/extractor/twentyfourvideo.py
parent7fe37d8a05609229332d5a156cb9b7cf4bba2790 (diff)
downloadyoutube-dl-747b028412828c66080c7f165b461a7ea490fead.tar.gz
youtube-dl-747b028412828c66080c7f165b461a7ea490fead.tar.xz
youtube-dl-747b028412828c66080c7f165b461a7ea490fead.zip
[24video] Fix extraction (Closes #7956)
Diffstat (limited to 'youtube_dl/extractor/twentyfourvideo.py')
-rw-r--r--youtube_dl/extractor/twentyfourvideo.py35
1 files changed, 12 insertions, 23 deletions
diff --git a/youtube_dl/extractor/twentyfourvideo.py b/youtube_dl/extractor/twentyfourvideo.py
index c1ee1decc..cb9e5f1b5 100644
--- a/youtube_dl/extractor/twentyfourvideo.py
+++ b/youtube_dl/extractor/twentyfourvideo.py
@@ -64,33 +64,22 @@ class TwentyFourVideoIE(InfoExtractor):
             r'<div class="comments-title" id="comments-count">(\d+) комментари',
             webpage, 'comment count', fatal=False))
 
-        formats = []
+        # Sets some cookies
+        self._download_xml(
+            r'http://www.24video.net/video/xml/%s?mode=init' % video_id,
+            video_id, 'Downloading init XML')
 
-        pc_video = self._download_xml(
+        video = self._download_xml(
             'http://www.24video.net/video/xml/%s?mode=play' % video_id,
-            video_id, 'Downloading PC video URL').find('.//video')
+            video_id, 'Downloading video XML').find('.//video')
 
-        formats.append({
-            'url': pc_video.attrib['url'],
-            'format_id': 'pc',
-            'quality': 1,
-        })
+        formats = [{
+            'url': video.attrib['url'],
+        }]
 
-        like_count = int_or_none(pc_video.get('ratingPlus'))
-        dislike_count = int_or_none(pc_video.get('ratingMinus'))
-        age_limit = 18 if pc_video.get('adult') == 'true' else 0
-
-        mobile_video = self._download_xml(
-            'http://www.24video.net/video/xml/%s' % video_id,
-            video_id, 'Downloading mobile video URL').find('.//video')
-
-        formats.append({
-            'url': mobile_video.attrib['url'],
-            'format_id': 'mobile',
-            'quality': 0,
-        })
-
-        self._sort_formats(formats)
+        like_count = int_or_none(video.get('ratingPlus'))
+        dislike_count = int_or_none(video.get('ratingMinus'))
+        age_limit = 18 if video.get('adult') == 'true' else 0
 
         return {
             'id': video_id,