3 from .common
import InfoExtractor
4 from ..compat
import compat_urllib_parse_urlparse
15 class IwaraIE(InfoExtractor
):
16 _VALID_URL
= r
'https?://(?:www\.|ecchi\.)?iwara\.tv/videos/(?P<id>[a-zA-Z0-9]+)'
18 'url': 'http://iwara.tv/videos/amVwUl1EHpAD9RD',
21 'id': 'amVwUl1EHpAD9RD',
23 'title': '【MMD R-18】ガールフレンド carry_me_off',
25 'thumbnail': 'https://i.iwara.tv/sites/default/files/videos/thumbnails/7951/thumbnail-7951_0001.png',
26 'uploader': 'Reimu丨Action',
27 'upload_date': '20150828',
28 'description': 'md5:1d4905ce48c66c9299c617f08e106e0f',
31 'url': 'http://ecchi.iwara.tv/videos/Vb4yf2yZspkzkBO',
32 'md5': '7e5f1f359cd51a027ba4a7b7710a50f0',
34 'id': '0B1LvuHnL-sRFNXB1WHNqbGw4SXc',
36 'title': '[3D Hentai] Kyonyu × Genkai × Emaki Shinobi Girls.mp4',
39 'add_ie': ['GoogleDrive'],
41 'url': 'http://www.iwara.tv/videos/nawkaumd6ilezzgq',
47 'title': '[MMD] Do It Again Ver.2 [1080p 60FPS] (Motion,Camera,Wav+DL)',
48 'description': 'md5:590c12c0df1443d833fbebe05da8c47a',
49 'upload_date': '20160910',
50 'uploader': 'aMMDsork',
51 'uploader_id': 'UCVOFyOSCyFkXTYYHITtqB7A',
53 'add_ie': ['Youtube'],
56 def _real_extract(self
, url
):
57 video_id
= self
._match
_id
(url
)
59 webpage
, urlh
= self
._download
_webpage
_handle
(url
, video_id
)
61 hostname
= compat_urllib_parse_urlparse(urlh
.geturl()).hostname
62 # ecchi is 'sexy' in Japanese
63 age_limit
= 18 if hostname
.split('.')[0] == 'ecchi' else 0
65 video_data
= self
._download
_json
('http://www.iwara.tv/api/video/%s' % video_id
, video_id
)
68 iframe_url
= self
._html
_search
_regex
(
69 r
'<iframe[^>]+src=([\'"])(?P<url>[^\'"]+)\
1',
70 webpage, 'iframe URL
', group='url
')
72 '_type
': 'url_transparent
',
74 'age_limit
': age_limit,
77 title = remove_end(self._html_extract_title(webpage), ' | Iwara
')
79 thumbnail = self._html_search_regex(
80 r'poster
=[\'"]([^\'"]+)', webpage, 'thumbnail
', default=None)
82 uploader = self._html_search_regex(
83 r'class="username">([^
<]+)', webpage, 'uploader
', fatal=False)
85 upload_date = unified_strdate(self._html_search_regex(
86 r'作成日
:([^\s
]+)', webpage, 'upload_date
', fatal=False))
88 description = strip_or_none(self._search_regex(
89 r'<p
>(.+?
(?
=</div
))', webpage, 'description
', fatal=False,
93 for a_format in video_data:
94 format_uri = url_or_none(a_format.get('uri
'))
97 format_id = a_format.get('resolution
')
98 height = int_or_none(self._search_regex(
99 r'(\d
+)p
', format_id, 'height
', default=None))
101 'url
': self._proto_relative_url(format_uri, 'https
:'),
102 'format_id
': format_id,
103 'ext
': mimetype2ext(a_format.get('mime
')) or 'mp4
',
105 'width
': int_or_none(height / 9.0 * 16.0 if height else None),
106 'quality
': 1 if format_id == 'Source
' else 0,
109 self._sort_formats(formats)
114 'age_limit
': age_limit,
116 'thumbnail
': self._proto_relative_url(thumbnail, 'https
:'),
117 'uploader
': uploader,
118 'upload_date
': upload_date,
119 'description
': description,