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.

47 lines
1.6 KiB

  1. #coding: utf-8
  2. from __future__ import unicode_literals
  3. import re
  4. from .common import InfoExtractor
  5. from ..utils import determine_ext
  6. class ThisAVIE(InfoExtractor):
  7. _VALID_URL = r'https?://(?:www\.)?thisav\.com/video/(?P<id>[0-9]+)/.*'
  8. _TEST = {
  9. 'url': 'http://www.thisav.com/video/47734/%98%26sup1%3B%83%9E%83%82---just-fit.html',
  10. 'md5': '0480f1ef3932d901f0e0e719f188f19b',
  11. 'info_dict': {
  12. 'id': '47734',
  13. 'ext': 'flv',
  14. 'title': '高樹マリア - Just fit',
  15. 'uploader': 'dj7970',
  16. 'uploader_id': 'dj7970'
  17. }
  18. }
  19. def _real_extract(self, url):
  20. mobj = re.match(self._VALID_URL, url)
  21. video_id = mobj.group('id')
  22. webpage = self._download_webpage(url, video_id)
  23. title = self._html_search_regex(r'<h1>([^<]*)</h1>', webpage, 'title')
  24. video_url = self._html_search_regex(
  25. r"addVariable\('file','([^']+)'\);", webpage, 'video url')
  26. uploader = self._html_search_regex(
  27. r': <a href="http://www.thisav.com/user/[0-9]+/(?:[^"]+)">([^<]+)</a>',
  28. webpage, 'uploader name', fatal=False)
  29. uploader_id = self._html_search_regex(
  30. r': <a href="http://www.thisav.com/user/[0-9]+/([^"]+)">(?:[^<]+)</a>',
  31. webpage, 'uploader id', fatal=False)
  32. ext = determine_ext(video_url)
  33. return {
  34. 'id': video_id,
  35. 'url': video_url,
  36. 'uploader': uploader,
  37. 'uploader_id': uploader_id,
  38. 'title': title,
  39. 'ext': ext,
  40. }