summary refs log tree commit diff
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2016-01-23 00:40:11 +0600
committerSergey M․ <dstftw@gmail.com>2016-01-23 00:40:11 +0600
commitb2c6528baf990d1fc0ad7b435595102ae2d8ba2d (patch)
tree71da59ede4440ee9124369be71420333fe43f899
parentea178204326c0d4203cc3ff88057d2ffd25a68a1 (diff)
downloadyoutube-dl-b2c6528baf990d1fc0ad7b435595102ae2d8ba2d.tar.gz
youtube-dl-b2c6528baf990d1fc0ad7b435595102ae2d8ba2d.tar.xz
youtube-dl-b2c6528baf990d1fc0ad7b435595102ae2d8ba2d.zip
[ruleporn] Rework in terms of nuevo (Closes #8206)
-rw-r--r--youtube_dl/extractor/__init__.py2
-rw-r--r--youtube_dl/extractor/ruleporn.py39
2 files changed, 27 insertions, 14 deletions
diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py
index dc8679d46..4ea6a3f71 100644
--- a/youtube_dl/extractor/__init__.py
+++ b/youtube_dl/extractor/__init__.py
@@ -580,7 +580,7 @@ from .rts import RTSIE
 from .rtve import RTVEALaCartaIE, RTVELiveIE, RTVEInfantilIE
 from .rtvnh import RTVNHIE
 from .ruhd import RUHDIE
-from .ruleporn import RulepornIE
+from .ruleporn import RulePornIE
 from .rutube import (
     RutubeIE,
     RutubeChannelIE,
diff --git a/youtube_dl/extractor/ruleporn.py b/youtube_dl/extractor/ruleporn.py
index 9e6a9125a..ebf9808d5 100644
--- a/youtube_dl/extractor/ruleporn.py
+++ b/youtube_dl/extractor/ruleporn.py
@@ -1,31 +1,44 @@
-# coding: utf-8
 from __future__ import unicode_literals
 
-from .common import InfoExtractor
+from .nuevo import NuevoBaseIE
 
 
-class RulepornIE(InfoExtractor):
-    _VALID_URL = r'https?://(?:www\.)?ruleporn\.com/(?:[a-z]+(?:-[a-z]+)+)'
+class RulePornIE(NuevoBaseIE):
+    _VALID_URL = r'https?://(?:www\.)?ruleporn\.com/(?:[^/?#&]+/)*(?P<id>[^/?#&]+)'
     _TEST = {
         'url': 'http://ruleporn.com/brunette-nympho-chick-takes-her-boyfriend-in-every-angle/',
         'md5': '86861ebc624a1097c7c10eaf06d7d505',
         'info_dict': {
             'id': '48212',
+            'display_id': 'brunette-nympho-chick-takes-her-boyfriend-in-every-angle',
             'ext': 'mp4',
             'title': 'Brunette Nympho Chick Takes Her Boyfriend In Every Angle',
+            'description': 'md5:6d28be231b981fff1981deaaa03a04d5',
+            'age_limit': 18,
+            'duration': 635.1,
         }
     }
 
     def _real_extract(self, url):
-        webpage = self._download_webpage(url, None)
+        display_id = self._match_id(url)
 
-        video_id = self._search_regex(r'http://lovehomeporn.com/embed/([0-9]+)', webpage, 'video_id', fatal=True)
-        title = self._search_regex(r'<h2 title="((?:\w|\s|\d)+)">', webpage, 'title', fatal=True)
-        info_xml = self._download_xml('http://lovehomeporn.com/media/nuevo/econfig.php?key=%s&rp=true' % video_id, video_id)
-        url = info_xml.find('file').text
+        webpage = self._download_webpage(url, display_id)
 
-        return {
-            'id': video_id,
+        video_id = self._search_regex(
+            r'lovehomeporn\.com/embed/(\d+)', webpage, 'video id')
+
+        title = self._search_regex(
+            r'<h2[^>]+title=(["\'])(?P<url>.+?)\1',
+            webpage, 'title', group='url')
+        description = self._html_search_meta('description', webpage)
+
+        info = self._extract_nuevo(
+            'http://lovehomeporn.com/media/nuevo/econfig.php?key=%s&rp=true' % video_id,
+            video_id)
+        info.update({
+            'display_id': display_id,
             'title': title,
-            'url': url,
-        }
+            'description': description,
+            'age_limit': 18
+        })
+        return info