[youtube] Fix extraction.
[youtube-dl] / youtube_dl / extractor / hentaistigma.py
1 from __future__ import unicode_literals
2
3 from .common import InfoExtractor
4
5
6 class HentaiStigmaIE(InfoExtractor):
7     _VALID_URL = r'^https?://hentai\.animestigma\.com/(?P<id>[^/]+)'
8     _TEST = {
9         'url': 'http://hentai.animestigma.com/inyouchuu-etsu-bonus/',
10         'md5': '4e3d07422a68a4cc363d8f57c8bf0d23',
11         'info_dict': {
12             'id': 'inyouchuu-etsu-bonus',
13             'ext': 'mp4',
14             'title': 'Inyouchuu Etsu Bonus',
15             'age_limit': 18,
16         }
17     }
18
19     def _real_extract(self, url):
20         video_id = self._match_id(url)
21
22         webpage = self._download_webpage(url, video_id)
23
24         title = self._html_search_regex(
25             r'<h2[^>]+class="posttitle"[^>]*><a[^>]*>([^<]+)</a>',
26             webpage, 'title')
27         wrap_url = self._html_search_regex(
28             r'<iframe[^>]+src="([^"]+mp4)"', webpage, 'wrapper url')
29         wrap_webpage = self._download_webpage(wrap_url, video_id)
30
31         video_url = self._html_search_regex(
32             r'file\s*:\s*"([^"]+)"', wrap_webpage, 'video url')
33
34         return {
35             'id': video_id,
36             'url': video_url,
37             'title': title,
38             'age_limit': 18,
39         }