[hentaistigma] Simplified (#2902)

This commit is contained in:
Philipp Hagemeister 2014-05-13 10:10:59 +02:00
parent 24e6ec8ac8
commit 56a94d8cbb
1 changed files with 25 additions and 26 deletions

View File

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