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