pornoxo.py 1.8 KB

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