logo

youtube-dl

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

hellporno.py (2716B)


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