youtube-dl/youtube_dl/extractor/hentaistigma.py

46 lines
1.3 KiB
Python
Raw Normal View History

# coding: utf-8
2014-05-13 17:10:59 +09:00
from __future__ import unicode_literals
2014-05-12 19:58:07 +09:00
from .common import InfoExtractor
from ..utils import (
merge_dicts,
traverse_obj,
)
2014-05-12 19:58:07 +09:00
2014-05-13 17:10:59 +09:00
2014-05-12 19:58:07 +09:00
class HentaiStigmaIE(InfoExtractor):
2014-05-13 17:10:59 +09:00
_VALID_URL = r'^https?://hentai\.animestigma\.com/(?P<id>[^/]+)'
2014-05-12 19:58:07 +09:00
_TEST = {
2014-05-13 17:10:59 +09:00
'url': 'http://hentai.animestigma.com/inyouchuu-etsu-bonus/',
'md5': '4e3d07422a68a4cc363d8f57c8bf0d23',
'info_dict': {
'id': 'inyouchuu-etsu-bonus',
'ext': 'mp4',
2016-02-14 18:37:17 +09:00
'title': 'Inyouchuu Etsu Bonus',
'age_limit': 18,
2014-05-12 19:58:07 +09:00
}
}
def _real_extract(self, url):
2015-06-30 01:21:09 +09:00
video_id = self._match_id(url)
2014-05-12 19:58:07 +09:00
webpage = self._download_webpage(url, video_id)
2014-05-13 17:10:59 +09:00
title = self._html_search_regex(
2015-06-30 01:21:09 +09:00
r'<h2[^>]+class="posttitle"[^>]*><a[^>]*>([^<]+)</a>',
2014-05-13 17:10:59 +09:00
webpage, 'title')
wrap_url = self._search_regex(
2015-06-30 01:21:09 +09:00
r'<iframe[^>]+src="([^"]+mp4)"', webpage, 'wrapper url')
2014-05-12 19:58:07 +09:00
vid_page = self._download_webpage(wrap_url, video_id)
entries = self._parse_html5_media_entries(wrap_url, vid_page, video_id)
self._sort_formats(traverse_obj(entries, (0, 'formats')) or [])
2014-05-12 19:58:07 +09:00
return merge_dicts({
2014-05-13 17:10:59 +09:00
'id': video_id,
'title': title,
'age_limit': 18,
}, entries[0])