logo

youtube-dl

[mirror] Download/Watch videos from video hostersgit clone https://hacktivis.me/git/mirror/youtube-dl.git

pornoxo.py (1939B)


  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. 'display_id': 'striptease-from-sexy-secretary',
  17. 'description': 'md5:0ee35252b685b3883f4a1d38332f9980',
  18. 'categories': list, # NSFW
  19. 'thumbnail': r're:https?://.*\.jpg$',
  20. 'age_limit': 18,
  21. }
  22. }
  23. def _real_extract(self, url):
  24. mobj = re.match(self._VALID_URL, url)
  25. video_id, display_id = mobj.groups()
  26. webpage = self._download_webpage(url, video_id)
  27. video_data = self._extract_jwplayer_data(webpage, video_id, require_title=False)
  28. title = self._html_search_regex(
  29. r'<title>([^<]+)\s*-\s*PornoXO', webpage, 'title')
  30. view_count = str_to_int(self._html_search_regex(
  31. r'[vV]iews:\s*([0-9,]+)', webpage, 'view count', fatal=False))
  32. categories_str = self._html_search_regex(
  33. r'<meta name="description" content=".*featuring\s*([^"]+)"',
  34. webpage, 'categories', fatal=False)
  35. categories = (
  36. None if categories_str is None
  37. else categories_str.split(','))
  38. video_data.update({
  39. 'id': video_id,
  40. 'title': title,
  41. 'display_id': display_id,
  42. 'description': self._html_search_meta('description', webpage),
  43. 'categories': categories,
  44. 'view_count': view_count,
  45. 'age_limit': 18,
  46. })
  47. return video_data