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.

65 lines
2.1 KiB

  1. from __future__ import unicode_literals
  2. import re
  3. from .common import InfoExtractor
  4. from ..utils import (
  5. str_to_int,
  6. )
  7. class PornoXOIE(InfoExtractor):
  8. _VALID_URL = r'https?://(?:www\.)?pornoxo\.com/videos/(?P<id>\d+)/(?P<display_id>[^/]+)\.html'
  9. _TEST = {
  10. 'url': 'http://www.pornoxo.com/videos/7564/striptease-from-sexy-secretary.html',
  11. 'md5': '582f28ecbaa9e6e24cb90f50f524ce87',
  12. 'info_dict': {
  13. 'id': '7564',
  14. 'ext': 'flv',
  15. 'title': 'Striptease From Sexy Secretary!',
  16. 'description': 'Striptease From Sexy Secretary!',
  17. 'categories': list, # NSFW
  18. 'thumbnail': 're:https?://.*\.jpg$',
  19. 'age_limit': 18,
  20. }
  21. }
  22. def _real_extract(self, url):
  23. mobj = re.match(self._VALID_URL, url)
  24. video_id = mobj.group('id')
  25. webpage = self._download_webpage(url, video_id)
  26. video_url = self._html_search_regex(
  27. r'\'file\'\s*:\s*"([^"]+)"', webpage, 'video_url')
  28. title = self._html_search_regex(
  29. r'<title>([^<]+)\s*-\s*PornoXO', webpage, 'title')
  30. description = self._html_search_regex(
  31. r'<meta name="description" content="([^"]+)\s*featuring',
  32. webpage, 'description', fatal=False)
  33. thumbnail = self._html_search_regex(
  34. r'\'image\'\s*:\s*"([^"]+)"', webpage, 'thumbnail', fatal=False)
  35. view_count = str_to_int(self._html_search_regex(
  36. r'[vV]iews:\s*([0-9,]+)', webpage, 'view count', fatal=False))
  37. categories_str = self._html_search_regex(
  38. r'<meta name="description" content=".*featuring\s*([^"]+)"',
  39. webpage, 'categories', fatal=False)
  40. categories = (
  41. None if categories_str is None
  42. else categories_str.split(','))
  43. return {
  44. 'id': video_id,
  45. 'url': video_url,
  46. 'title': title,
  47. 'description': description,
  48. 'thumbnail': thumbnail,
  49. 'categories': categories,
  50. 'view_count': view_count,
  51. 'age_limit': 18,
  52. }