You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
2.5 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. from ..compat import compat_urllib_parse_urlparse
  5. from ..utils import remove_end
  6. class IwaraIE(InfoExtractor):
  7. _VALID_URL = r'https?://(?:www\.|ecchi\.)?iwara\.tv/videos/(?P<id>[a-zA-Z0-9]+)'
  8. _TESTS = [{
  9. 'url': 'http://iwara.tv/videos/amVwUl1EHpAD9RD',
  10. 'md5': '1d53866b2c514b23ed69e4352fdc9839',
  11. 'info_dict': {
  12. 'id': 'amVwUl1EHpAD9RD',
  13. 'ext': 'mp4',
  14. 'title': '【MMD R-18】ガールフレンド carry_me_off',
  15. 'age_limit': 18,
  16. },
  17. }, {
  18. 'url': 'http://ecchi.iwara.tv/videos/Vb4yf2yZspkzkBO',
  19. 'md5': '7e5f1f359cd51a027ba4a7b7710a50f0',
  20. 'info_dict': {
  21. 'id': '0B1LvuHnL-sRFNXB1WHNqbGw4SXc',
  22. 'ext': 'mp4',
  23. 'title': '[3D Hentai] Kyonyu Ã\x97 Genkai Ã\x97 Emaki Shinobi Girls.mp4',
  24. 'age_limit': 18,
  25. },
  26. 'add_ie': ['GoogleDrive'],
  27. }, {
  28. 'url': 'http://www.iwara.tv/videos/nawkaumd6ilezzgq',
  29. 'md5': '1d85f1e5217d2791626cff5ec83bb189',
  30. 'info_dict': {
  31. 'id': '6liAP9s2Ojc',
  32. 'ext': 'mp4',
  33. 'age_limit': 0,
  34. 'title': '[MMD] Do It Again Ver.2 [1080p 60FPS] (Motion,Camera,Wav+DL)',
  35. 'description': 'md5:590c12c0df1443d833fbebe05da8c47a',
  36. 'upload_date': '20160910',
  37. 'uploader': 'aMMDsork',
  38. 'uploader_id': 'UCVOFyOSCyFkXTYYHITtqB7A',
  39. },
  40. 'add_ie': ['Youtube'],
  41. }]
  42. def _real_extract(self, url):
  43. video_id = self._match_id(url)
  44. webpage, urlh = self._download_webpage_handle(url, video_id)
  45. hostname = compat_urllib_parse_urlparse(urlh.geturl()).hostname
  46. # ecchi is 'sexy' in Japanese
  47. age_limit = 18 if hostname.split('.')[0] == 'ecchi' else 0
  48. entries = self._parse_html5_media_entries(url, webpage, video_id)
  49. if not entries:
  50. iframe_url = self._html_search_regex(
  51. r'<iframe[^>]+src=([\'"])(?P<url>[^\'"]+)\1',
  52. webpage, 'iframe URL', group='url')
  53. return {
  54. '_type': 'url_transparent',
  55. 'url': iframe_url,
  56. 'age_limit': age_limit,
  57. }
  58. title = remove_end(self._html_search_regex(
  59. r'<title>([^<]+)</title>', webpage, 'title'), ' | Iwara')
  60. info_dict = entries[0]
  61. info_dict.update({
  62. 'id': video_id,
  63. 'title': title,
  64. 'age_limit': age_limit,
  65. })
  66. return info_dict