hellporno.py 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. from .common import InfoExtractor
  2. from ..utils import (
  3. int_or_none,
  4. merge_dicts,
  5. remove_end,
  6. unified_timestamp,
  7. )
  8. class HellPornoIE(InfoExtractor):
  9. _VALID_URL = r'https?://(?:www\.)?hellporno\.(?:com/videos|net/v)/(?P<id>[^/]+)'
  10. _TESTS = [{
  11. 'url': 'http://hellporno.com/videos/dixie-is-posing-with-naked-ass-very-erotic/',
  12. 'md5': 'f0a46ebc0bed0c72ae8fe4629f7de5f3',
  13. 'info_dict': {
  14. 'id': '149116',
  15. 'display_id': 'dixie-is-posing-with-naked-ass-very-erotic',
  16. 'ext': 'mp4',
  17. 'title': 'Dixie is posing with naked ass very erotic',
  18. 'description': 'md5:9a72922749354edb1c4b6e540ad3d215',
  19. 'categories': list,
  20. 'thumbnail': r're:https?://.*\.jpg$',
  21. 'duration': 240,
  22. 'timestamp': 1398762720,
  23. 'upload_date': '20140429',
  24. 'view_count': int,
  25. 'age_limit': 18,
  26. },
  27. }, {
  28. 'url': 'http://hellporno.net/v/186271/',
  29. 'only_matching': True,
  30. }]
  31. def _real_extract(self, url):
  32. display_id = self._match_id(url)
  33. webpage = self._download_webpage(url, display_id)
  34. title = remove_end(self._html_extract_title(webpage), ' - Hell Porno')
  35. info = self._parse_html5_media_entries(url, webpage, display_id)[0]
  36. video_id = self._search_regex(
  37. (r'chs_object\s*=\s*["\'](\d+)',
  38. r'params\[["\']video_id["\']\]\s*=\s*(\d+)'), webpage, 'video id',
  39. default=display_id)
  40. description = self._search_regex(
  41. r'class=["\']desc_video_view_v2[^>]+>([^<]+)', webpage,
  42. 'description', fatal=False)
  43. categories = [
  44. c.strip()
  45. for c in self._html_search_meta(
  46. 'keywords', webpage, 'categories', default='').split(',')
  47. if c.strip()]
  48. duration = int_or_none(self._og_search_property(
  49. 'video:duration', webpage, fatal=False))
  50. timestamp = unified_timestamp(self._og_search_property(
  51. 'video:release_date', webpage, fatal=False))
  52. view_count = int_or_none(self._search_regex(
  53. r'>Views\s+(\d+)', webpage, 'view count', fatal=False))
  54. return merge_dicts(info, {
  55. 'id': video_id,
  56. 'display_id': display_id,
  57. 'title': title,
  58. 'description': description,
  59. 'categories': categories,
  60. 'duration': duration,
  61. 'timestamp': timestamp,
  62. 'view_count': view_count,
  63. 'age_limit': 18,
  64. })