pornoxo.py 1.9 KB

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