aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/iwara.py
diff options
context:
space:
mode:
authorYen Chi Hsuan <yan12125@gmail.com>2016-09-11 03:02:00 +0800
committerYen Chi Hsuan <yan12125@gmail.com>2016-09-11 03:02:00 +0800
commit001a5fd3d75b311102264cf3920c6aa5b2322e51 (patch)
tree35935a6fca7db5bd5f8c198fb0104d43d8986f93 /youtube_dl/extractor/iwara.py
parent1e35999c1e4637174e2532c457431315b5e186d9 (diff)
[iwara] Fix extraction after relaunch
Closes #10462, closes #3215
Diffstat (limited to 'youtube_dl/extractor/iwara.py')
-rw-r--r--youtube_dl/extractor/iwara.py77
1 files changed, 77 insertions, 0 deletions
diff --git a/youtube_dl/extractor/iwara.py b/youtube_dl/extractor/iwara.py
new file mode 100644
index 000000000..8d7e7f472
--- /dev/null
+++ b/youtube_dl/extractor/iwara.py
@@ -0,0 +1,77 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+from ..compat import compat_urllib_parse_urlparse
+from ..utils import remove_end
+
+
+class IwaraIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.|ecchi\.)?iwara\.tv/videos/(?P<id>[a-zA-Z0-9]+)'
+ _TESTS = [{
+ 'url': 'http://iwara.tv/videos/amVwUl1EHpAD9RD',
+ 'md5': '1d53866b2c514b23ed69e4352fdc9839',
+ 'info_dict': {
+ 'id': 'amVwUl1EHpAD9RD',
+ 'ext': 'mp4',
+ 'title': '【MMD R-18】ガールフレンド carry_me_off',
+ 'age_limit': 18,
+ },
+ }, {
+ 'url': 'http://ecchi.iwara.tv/videos/Vb4yf2yZspkzkBO',
+ 'md5': '7e5f1f359cd51a027ba4a7b7710a50f0',
+ 'info_dict': {
+ 'id': '0B1LvuHnL-sRFNXB1WHNqbGw4SXc',
+ 'ext': 'mp4',
+ 'title': '[3D Hentai] Kyonyu Ã\x97 Genkai Ã\x97 Emaki Shinobi Girls.mp4',
+ 'age_limit': 18,
+ },
+ 'add_ie': ['GoogleDrive'],
+ }, {
+ 'url': 'http://www.iwara.tv/videos/nawkaumd6ilezzgq',
+ 'md5': '1d85f1e5217d2791626cff5ec83bb189',
+ 'info_dict': {
+ 'id': '6liAP9s2Ojc',
+ 'ext': 'mp4',
+ 'age_limit': 0,
+ 'title': '[MMD] Do It Again Ver.2 [1080p 60FPS] (Motion,Camera,Wav+DL)',
+ 'description': 'md5:590c12c0df1443d833fbebe05da8c47a',
+ 'upload_date': '20160910',
+ 'uploader': 'aMMDsork',
+ 'uploader_id': 'UCVOFyOSCyFkXTYYHITtqB7A',
+ },
+ 'add_ie': ['Youtube'],
+ }]
+
+ def _real_extract(self, url):
+ video_id = self._match_id(url)
+
+ webpage, urlh = self._download_webpage_handle(url, video_id)
+
+ hostname = compat_urllib_parse_urlparse(urlh.geturl()).hostname
+ # ecchi is 'sexy' in Japanese
+ age_limit = 18 if hostname.split('.')[0] == 'ecchi' else 0
+
+ entries = self._parse_html5_media_entries(url, webpage, video_id)
+
+ if not entries:
+ iframe_url = self._html_search_regex(
+ r'<iframe[^>]+src=([\'"])(?P<url>[^\'"]+)\1',
+ webpage, 'iframe URL', group='url')
+ return {
+ '_type': 'url_transparent',
+ 'url': iframe_url,
+ 'age_limit': age_limit,
+ }
+
+ title = remove_end(self._html_search_regex(
+ r'<title>([^<]+)</title>', webpage, 'title'), ' | Iwara')
+
+ info_dict = entries[0]
+ info_dict.update({
+ 'id': video_id,
+ 'title': title,
+ 'age_limit': age_limit,
+ })
+
+ return info_dict