logo

youtube-dl

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

alphaporno.py (2724B)


  1. from __future__ import unicode_literals
  2. from .common import InfoExtractor
  3. from ..utils import (
  4. parse_iso8601,
  5. parse_duration,
  6. parse_filesize,
  7. int_or_none,
  8. )
  9. class AlphaPornoIE(InfoExtractor):
  10. _VALID_URL = r'https?://(?:www\.)?alphaporno\.com/videos/(?P<id>[^/]+)'
  11. _TEST = {
  12. 'url': 'http://www.alphaporno.com/videos/sensual-striptease-porn-with-samantha-alexandra/',
  13. 'md5': 'feb6d3bba8848cd54467a87ad34bd38e',
  14. 'info_dict': {
  15. 'id': '258807',
  16. 'display_id': 'sensual-striptease-porn-with-samantha-alexandra',
  17. 'ext': 'mp4',
  18. 'title': 'Sensual striptease porn with Samantha Alexandra',
  19. 'thumbnail': r're:https?://.*\.jpg$',
  20. 'timestamp': 1418694611,
  21. 'upload_date': '20141216',
  22. 'duration': 387,
  23. 'filesize_approx': 54120000,
  24. 'tbr': 1145,
  25. 'categories': list,
  26. 'age_limit': 18,
  27. }
  28. }
  29. def _real_extract(self, url):
  30. display_id = self._match_id(url)
  31. webpage = self._download_webpage(url, display_id)
  32. video_id = self._search_regex(
  33. r"video_id\s*:\s*'([^']+)'", webpage, 'video id', default=None)
  34. video_url = self._search_regex(
  35. r"video_url\s*:\s*'([^']+)'", webpage, 'video url')
  36. ext = self._html_search_meta(
  37. 'encodingFormat', webpage, 'ext', default='.mp4')[1:]
  38. title = self._search_regex(
  39. [r'<meta content="([^"]+)" itemprop="description">',
  40. r'class="title" itemprop="name">([^<]+)<'],
  41. webpage, 'title')
  42. thumbnail = self._html_search_meta('thumbnail', webpage, 'thumbnail')
  43. timestamp = parse_iso8601(self._html_search_meta(
  44. 'uploadDate', webpage, 'upload date'))
  45. duration = parse_duration(self._html_search_meta(
  46. 'duration', webpage, 'duration'))
  47. filesize_approx = parse_filesize(self._html_search_meta(
  48. 'contentSize', webpage, 'file size'))
  49. bitrate = int_or_none(self._html_search_meta(
  50. 'bitrate', webpage, 'bitrate'))
  51. categories = self._html_search_meta(
  52. 'keywords', webpage, 'categories', default='').split(',')
  53. age_limit = self._rta_search(webpage)
  54. return {
  55. 'id': video_id,
  56. 'display_id': display_id,
  57. 'url': video_url,
  58. 'ext': ext,
  59. 'title': title,
  60. 'thumbnail': thumbnail,
  61. 'timestamp': timestamp,
  62. 'duration': duration,
  63. 'filesize_approx': filesize_approx,
  64. 'tbr': bitrate,
  65. 'categories': categories,
  66. 'age_limit': age_limit,
  67. }