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.

67 lines
2.3 KiB

10 years ago
10 years ago
  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. import re
  4. from .common import InfoExtractor
  5. from ..utils import remove_end
  6. class ThisAVIE(InfoExtractor):
  7. _VALID_URL = r'https?://(?:www\.)?thisav\.com/video/(?P<id>[0-9]+)/.*'
  8. _TESTS = [{
  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. 'url': 'http://www.thisav.com/video/242352/nerdy-18yo-big-ass-tattoos-and-glasses.html',
  20. 'md5': 'ba90c076bd0f80203679e5b60bf523ee',
  21. 'info_dict': {
  22. 'id': '242352',
  23. 'ext': 'mp4',
  24. 'title': 'Nerdy 18yo Big Ass Tattoos and Glasses',
  25. 'uploader': 'cybersluts',
  26. 'uploader_id': 'cybersluts',
  27. },
  28. }]
  29. def _real_extract(self, url):
  30. mobj = re.match(self._VALID_URL, url)
  31. video_id = mobj.group('id')
  32. webpage = self._download_webpage(url, video_id)
  33. title = remove_end(self._html_search_regex(
  34. r'<title>([^<]+)</title>', webpage, 'title'),
  35. ' - 視頻 - ThisAV.com-世界第一中文成人娛樂網站')
  36. video_url = self._html_search_regex(
  37. r"addVariable\('file','([^']+)'\);", webpage, 'video url', default=None)
  38. if video_url:
  39. info_dict = {
  40. 'formats': [{
  41. 'url': video_url,
  42. }],
  43. }
  44. else:
  45. info_dict = self._extract_jwplayer_data(
  46. webpage, video_id, require_title=False)
  47. uploader = self._html_search_regex(
  48. r': <a href="http://www.thisav.com/user/[0-9]+/(?:[^"]+)">([^<]+)</a>',
  49. webpage, 'uploader name', fatal=False)
  50. uploader_id = self._html_search_regex(
  51. r': <a href="http://www.thisav.com/user/[0-9]+/([^"]+)">(?:[^<]+)</a>',
  52. webpage, 'uploader id', fatal=False)
  53. info_dict.update({
  54. 'id': video_id,
  55. 'uploader': uploader,
  56. 'uploader_id': uploader_id,
  57. 'title': title,
  58. })
  59. return info_dict