[ruleporn] Add new extractor
authorDankryn <dankryn@weg-werf-email.de>
Mon, 11 Jan 2016 20:17:30 +0000 (21:17 +0100)
committerSergey M․ <dstftw@gmail.com>
Fri, 22 Jan 2016 18:13:27 +0000 (00:13 +0600)
youtube_dl/extractor/__init__.py
youtube_dl/extractor/ruleporn.py [new file with mode: 0644]

index 6f2b35cf110eba2dd8c3e87b30d6d8024b916270..dc8679d4677b7e0248d6eb91099afd77f8e72d95 100644 (file)
@@ -580,6 +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 .rutube import (
     RutubeIE,
     RutubeChannelIE,
diff --git a/youtube_dl/extractor/ruleporn.py b/youtube_dl/extractor/ruleporn.py
new file mode 100644 (file)
index 0000000..9e6a912
--- /dev/null
@@ -0,0 +1,31 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+
+
+class RulepornIE(InfoExtractor):
+    _VALID_URL = r'https?://(?:www\.)?ruleporn\.com/(?:[a-z]+(?:-[a-z]+)+)'
+    _TEST = {
+        'url': 'http://ruleporn.com/brunette-nympho-chick-takes-her-boyfriend-in-every-angle/',
+        'md5': '86861ebc624a1097c7c10eaf06d7d505',
+        'info_dict': {
+            'id': '48212',
+            'ext': 'mp4',
+            'title': 'Brunette Nympho Chick Takes Her Boyfriend In Every Angle',
+        }
+    }
+
+    def _real_extract(self, url):
+        webpage = self._download_webpage(url, None)
+
+        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
+
+        return {
+            'id': video_id,
+            'title': title,
+            'url': url,
+        }