[hentaistigma] Simplified (#2902)
authorPhilipp Hagemeister <phihag@phihag.de>
Tue, 13 May 2014 08:10:59 +0000 (10:10 +0200)
committerPhilipp Hagemeister <phihag@phihag.de>
Tue, 13 May 2014 08:10:59 +0000 (10:10 +0200)
youtube_dl/extractor/hentaistigma.py

index 4f2d30599df71c98585cf45e4c8f096f74276724..63d87b74cc2d5258960fce3b0c6cd5eca48a0b11 100644 (file)
@@ -1,43 +1,42 @@
+from __future__ import unicode_literals
+
 import re
 
 from .common import InfoExtractor
 
+
 class HentaiStigmaIE(InfoExtractor):
-    _VALID_URL = r'^https?://hentai\.animestigma\.com/(?P<videoid>[^/]+)'
+    _VALID_URL = r'^https?://hentai\.animestigma\.com/(?P<id>[^/]+)'
     _TEST = {
-        u'url': u'http://hentai.animestigma.com/inyouchuu-etsu-bonus/',
-        u'file': u'inyouchuu-etsu-bonus.mp4',
-        u'md5': u'4e3d07422a68a4cc363d8f57c8bf0d23',
-        u'info_dict': {
-            u"title": u"Inyouchuu Etsu Bonus",
-            u"age_limit": 18,
+        'url': 'http://hentai.animestigma.com/inyouchuu-etsu-bonus/',
+        'md5': '4e3d07422a68a4cc363d8f57c8bf0d23',
+        'info_dict': {
+            'id': 'inyouchuu-etsu-bonus',
+            'ext': 'mp4',
+            "title": "Inyouchuu Etsu Bonus",
+            "age_limit": 18,
         }
     }
 
     def _real_extract(self, url):
         mobj = re.match(self._VALID_URL, url)
+        video_id = mobj.group('id')
 
-        video_id = mobj.group('videoid')
-
-        # Get webpage content
         webpage = self._download_webpage(url, video_id)
 
-        # Get the video title
-        video_title = self._html_search_regex(r'<h2 class="posttitle"><a[^>]*>([^<]+)</a>',
-            webpage, u'title').strip()
-
-        # Get the wrapper url
-        wrap_url = self._html_search_regex(r'<iframe src="([^"]+mp4)"', webpage, u'wrapper url')
-
-        # Get wrapper content
+        title = self._html_search_regex(
+            r'<h2 class="posttitle"><a[^>]*>([^<]+)</a>',
+            webpage, 'title')
+        wrap_url = self._html_search_regex(
+            r'<iframe src="([^"]+mp4)"', webpage, 'wrapper url')
         wrap_webpage = self._download_webpage(wrap_url, video_id)
 
-        video_url = self._html_search_regex(r'clip:\s*{\s*url: "([^"]*)"', wrap_webpage, u'video url')
-
-        info = {'id': video_id,
-                'url': video_url,
-                'title': video_title,
-                'format': 'mp4',
-                'age_limit': 18}
+        video_url = self._html_search_regex(
+            r'clip:\s*{\s*url: "([^"]*)"', wrap_webpage, 'video url')
 
-        return [info]
+        return {
+            'id': video_id,
+            'url': video_url,
+            'title': title,
+            'age_limit': 18,
+        }