logo

youtube-dl

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

yourporn.py (2062B)


  1. from __future__ import unicode_literals
  2. from .common import InfoExtractor
  3. from ..compat import compat_str
  4. from ..utils import (
  5. parse_duration,
  6. urljoin,
  7. )
  8. class YourPornIE(InfoExtractor):
  9. _VALID_URL = r'https?://(?:www\.)?sxyprn\.com/post/(?P<id>[^/?#&.]+)'
  10. _TESTS = [{
  11. 'url': 'https://sxyprn.com/post/57ffcb2e1179b.html',
  12. 'md5': '6f8682b6464033d87acaa7a8ff0c092e',
  13. 'info_dict': {
  14. 'id': '57ffcb2e1179b',
  15. 'ext': 'mp4',
  16. 'title': 'md5:c9f43630bd968267672651ba905a7d35',
  17. 'thumbnail': r're:^https?://.*\.jpg$',
  18. 'duration': 165,
  19. 'age_limit': 18,
  20. },
  21. 'params': {
  22. 'skip_download': True,
  23. },
  24. }, {
  25. 'url': 'https://sxyprn.com/post/57ffcb2e1179b.html',
  26. 'only_matching': True,
  27. }]
  28. def _real_extract(self, url):
  29. video_id = self._match_id(url)
  30. webpage = self._download_webpage(url, video_id)
  31. parts = self._parse_json(
  32. self._search_regex(
  33. r'data-vnfo=(["\'])(?P<data>{.+?})\1', webpage, 'data info',
  34. group='data'),
  35. video_id)[video_id].split('/')
  36. num = 0
  37. for c in parts[6] + parts[7]:
  38. if c.isnumeric():
  39. num += int(c)
  40. parts[5] = compat_str(int(parts[5]) - num)
  41. parts[1] += '8'
  42. video_url = urljoin(url, '/'.join(parts))
  43. title = (self._search_regex(
  44. r'<[^>]+\bclass=["\']PostEditTA[^>]+>([^<]+)', webpage, 'title',
  45. default=None) or self._og_search_description(webpage)).strip()
  46. thumbnail = self._og_search_thumbnail(webpage)
  47. duration = parse_duration(self._search_regex(
  48. r'duration\s*:\s*<[^>]+>([\d:]+)', webpage, 'duration',
  49. default=None))
  50. return {
  51. 'id': video_id,
  52. 'url': video_url,
  53. 'title': title,
  54. 'thumbnail': thumbnail,
  55. 'duration': duration,
  56. 'age_limit': 18,
  57. 'ext': 'mp4',
  58. }