logo

youtube-dl

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

hornbunny.py (1527B)


  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. from ..utils import (
  5. int_or_none,
  6. parse_duration,
  7. )
  8. class HornBunnyIE(InfoExtractor):
  9. _VALID_URL = r'http?://(?:www\.)?hornbunny\.com/videos/(?P<title_dash>[a-z-]+)-(?P<id>\d+)\.html'
  10. _TEST = {
  11. 'url': 'http://hornbunny.com/videos/panty-slut-jerk-off-instruction-5227.html',
  12. 'md5': 'e20fd862d1894b67564c96f180f43924',
  13. 'info_dict': {
  14. 'id': '5227',
  15. 'ext': 'mp4',
  16. 'title': 'panty slut jerk off instruction',
  17. 'duration': 550,
  18. 'age_limit': 18,
  19. 'view_count': int,
  20. 'thumbnail': r're:^https?://.*\.jpg$',
  21. }
  22. }
  23. def _real_extract(self, url):
  24. video_id = self._match_id(url)
  25. webpage = self._download_webpage(url, video_id)
  26. title = self._og_search_title(webpage)
  27. info_dict = self._parse_html5_media_entries(url, webpage, video_id)[0]
  28. duration = parse_duration(self._search_regex(
  29. r'<strong>Runtime:</strong>\s*([0-9:]+)</div>',
  30. webpage, 'duration', fatal=False))
  31. view_count = int_or_none(self._search_regex(
  32. r'<strong>Views:</strong>\s*(\d+)</div>',
  33. webpage, 'view count', fatal=False))
  34. info_dict.update({
  35. 'id': video_id,
  36. 'title': title,
  37. 'duration': duration,
  38. 'view_count': view_count,
  39. 'age_limit': 18,
  40. })
  41. return info_dict