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. import re
  3. from .common import InfoExtractor
  4. from ..utils import (
  5. determine_ext,
  6. )
  7. class ThisAVIE(InfoExtractor):
  8. _VALID_URL = r'https?://(?:www\.)?thisav\.com/video/(?P<id>[0-9]+)/.*'
  9. _TEST = {
  10. u"url": u"http://www.thisav.com/video/47734/%98%26sup1%3B%83%9E%83%82---just-fit.html",
  11. u"file": u"47734.flv",
  12. u"md5": u"0480f1ef3932d901f0e0e719f188f19b",
  13. u"info_dict": {
  14. u"title": u"高樹マリア - Just fit",
  15. u"uploader": u"dj7970",
  16. u"uploader_id": u"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, u'title')
  24. video_url = self._html_search_regex(
  25. r"addVariable\('file','([^']+)'\);", webpage, u'video url')
  26. uploader = self._html_search_regex(
  27. r': <a href="http://www.thisav.com/user/[0-9]+/(?:[^"]+)">([^<]+)</a>',
  28. webpage, u'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, u'uploader id', fatal=False)
  32. ext = determine_ext(video_url)
  33. return {
  34. '_type': 'video',
  35. 'id': video_id,
  36. 'url': video_url,
  37. 'uploader': uploader,
  38. 'uploader_id': uploader_id,
  39. 'title': title,
  40. 'ext': ext,
  41. }