logo

youtube-dl

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

peekvids.py (7417B)


  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. import re
  4. from .common import InfoExtractor
  5. from ..utils import (
  6. ExtractorError,
  7. get_element_by_class,
  8. int_or_none,
  9. merge_dicts,
  10. url_or_none,
  11. )
  12. class PeekVidsIE(InfoExtractor):
  13. _VALID_URL = r'''(?x)
  14. https?://(?:www\.)?peekvids\.com/
  15. (?:(?:[^/?#]+/){2}|embed/?\?(?:[^#]*&)?v=)
  16. (?P<id>[^/?&#]*)
  17. '''
  18. _TESTS = [{
  19. 'url': 'https://peekvids.com/pc/dane-jones-cute-redhead-with-perfect-tits-with-mini-vamp/BSyLMbN0YCd',
  20. 'md5': '2ff6a357a9717dc9dc9894b51307e9a2',
  21. 'info_dict': {
  22. 'id': '1262717',
  23. 'display_id': 'BSyLMbN0YCd',
  24. 'title': ' Dane Jones - Cute redhead with perfect tits with Mini Vamp',
  25. 'ext': 'mp4',
  26. 'thumbnail': r're:^https?://.*\.jpg$',
  27. 'description': 'md5:0a61df3620de26c0af8963b1a730cd69',
  28. 'timestamp': 1642579329,
  29. 'upload_date': '20220119',
  30. 'duration': 416,
  31. 'view_count': int,
  32. 'age_limit': 18,
  33. 'uploader': 'SEXYhub.com',
  34. 'categories': list,
  35. 'tags': list,
  36. },
  37. }]
  38. _DOMAIN = 'www.peekvids.com'
  39. def _get_detail(self, html):
  40. return get_element_by_class('detail-video-block', html)
  41. def _real_extract(self, url):
  42. video_id = self._match_id(url)
  43. webpage = self._download_webpage(url, video_id, expected_status=429)
  44. if '>Rate Limit Exceeded' in webpage:
  45. raise ExtractorError(
  46. '[%s] %s: %s' % (self.IE_NAME, video_id, 'You are suspected as a bot. Wait, or pass the captcha test on the site and provide --cookies.'),
  47. expected=True)
  48. title = self._html_search_regex(r'(?s)<h1\b[^>]*>(.+?)</h1>', webpage, 'title')
  49. display_id = video_id
  50. video_id = self._search_regex(r'(?s)<video\b[^>]+\bdata-id\s*=\s*["\']?([\w-]+)', webpage, 'short video ID')
  51. srcs = self._download_json(
  52. 'https://%s/v-alt/%s' % (self._DOMAIN, video_id), video_id,
  53. note='Downloading list of source files')
  54. formats = [{
  55. 'url': f_url,
  56. 'format_id': f_id,
  57. 'height': int_or_none(f_id),
  58. } for f_url, f_id in (
  59. (url_or_none(f_v), f_match.group(1))
  60. for f_v, f_match in (
  61. (v, re.match(r'^data-src(\d{3,})$', k))
  62. for k, v in srcs.items() if v) if f_match)
  63. if f_url
  64. ]
  65. if not formats:
  66. formats = [{'url': url} for url in srcs.values()]
  67. self._sort_formats(formats)
  68. info = self._search_json_ld(webpage, video_id, expected_type='VideoObject', default={})
  69. info.pop('url', None)
  70. # may not have found the thumbnail if it was in a list in the ld+json
  71. info.setdefault('thumbnail', self._og_search_thumbnail(webpage))
  72. detail = self._get_detail(webpage) or ''
  73. info['description'] = self._html_search_regex(
  74. r'(?s)(.+?)(?:%s\s*<|<ul\b)' % (re.escape(info.get('description', '')), ),
  75. detail, 'description', default=None) or None
  76. info['title'] = re.sub(r'\s*[,-][^,-]+$', '', info.get('title') or title) or self._generic_title(url)
  77. def cat_tags(name, html):
  78. l = self._html_search_regex(
  79. r'(?s)<span\b[^>]*>\s*%s\s*:\s*</span>(.+?)</li>' % (re.escape(name), ),
  80. html, name, default='')
  81. return [x for x in re.split(r'\s+', l) if x]
  82. return merge_dicts({
  83. 'id': video_id,
  84. 'display_id': display_id,
  85. 'age_limit': 18,
  86. 'formats': formats,
  87. 'categories': cat_tags('Categories', detail),
  88. 'tags': cat_tags('Tags', detail),
  89. 'uploader': self._html_search_regex(r'[Uu]ploaded\s+by\s(.+?)"', webpage, 'uploader', default=None),
  90. }, info)
  91. class PlayVidsIE(PeekVidsIE):
  92. _VALID_URL = r'https?://(?:www\.)?playvids\.com/(?:embed/|\w\w?/)?(?P<id>[^/?#]*)'
  93. _TESTS = [{
  94. 'url': 'https://www.playvids.com/U3pBrYhsjXM/pc/dane-jones-cute-redhead-with-perfect-tits-with-mini-vamp',
  95. 'md5': '2f12e50213dd65f142175da633c4564c',
  96. 'info_dict': {
  97. 'id': '1978030',
  98. 'display_id': 'U3pBrYhsjXM',
  99. 'title': ' Dane Jones - Cute redhead with perfect tits with Mini Vamp',
  100. 'ext': 'mp4',
  101. 'thumbnail': r're:^https?://.*\.jpg$',
  102. 'description': 'md5:0a61df3620de26c0af8963b1a730cd69',
  103. 'timestamp': 1640435839,
  104. 'upload_date': '20211225',
  105. 'duration': 416,
  106. 'view_count': int,
  107. 'age_limit': 18,
  108. 'uploader': 'SEXYhub.com',
  109. 'categories': list,
  110. 'tags': list,
  111. },
  112. }, {
  113. 'url': 'https://www.playvids.com/es/U3pBrYhsjXM/pc/dane-jones-cute-redhead-with-perfect-tits-with-mini-vamp',
  114. 'only_matching': True,
  115. }, {
  116. 'url': 'https://www.playvids.com/embed/U3pBrYhsjXM',
  117. 'only_matching': True,
  118. }, {
  119. 'url': 'https://www.playvids.com/bKmGLe3IwjZ/sv/brazzers-800-phone-sex-madison-ivy-always-on-the-line',
  120. 'md5': 'e783986e596cafbf46411a174ab42ba6',
  121. 'info_dict': {
  122. 'id': '762385',
  123. 'display_id': 'bKmGLe3IwjZ',
  124. 'ext': 'mp4',
  125. 'title': 'Brazzers - 1 800 Phone Sex: Madison Ivy Always On The Line 6',
  126. 'description': 'md5:bdcd2db2b8ad85831a491d7c8605dcef',
  127. 'timestamp': 1516958544,
  128. 'upload_date': '20180126',
  129. 'thumbnail': r're:^https?://.*\.jpg$',
  130. 'duration': 480,
  131. 'uploader': 'Brazzers',
  132. 'age_limit': 18,
  133. 'view_count': int,
  134. 'age_limit': 18,
  135. 'categories': list,
  136. 'tags': list,
  137. },
  138. }, {
  139. 'url': 'https://www.playvids.com/v/47iUho33toY',
  140. 'md5': 'b056b5049d34b648c1e86497cf4febce',
  141. 'info_dict': {
  142. 'id': '700621',
  143. 'display_id': '47iUho33toY',
  144. 'ext': 'mp4',
  145. 'title': 'KATEE OWEN STRIPTIASE IN SEXY RED LINGERIE',
  146. 'description': None,
  147. 'timestamp': 1507052209,
  148. 'upload_date': '20171003',
  149. 'thumbnail': r're:^https?://.*\.jpg$',
  150. 'duration': 332,
  151. 'uploader': 'Cacerenele',
  152. 'age_limit': 18,
  153. 'view_count': int,
  154. 'categories': list,
  155. 'tags': list,
  156. }
  157. }, {
  158. 'url': 'https://www.playvids.com/z3_7iwWCmqt/sexy-teen-filipina-striptease-beautiful-pinay-bargirl-strips-and-dances',
  159. 'md5': 'efa09be9f031314b7b7e3bc6510cd0df',
  160. 'info_dict': {
  161. 'id': '1523518',
  162. 'display_id': 'z3_7iwWCmqt',
  163. 'ext': 'mp4',
  164. 'title': 'SEXY TEEN FILIPINA STRIPTEASE - Beautiful Pinay Bargirl Strips and Dances',
  165. 'description': None,
  166. 'timestamp': 1607470323,
  167. 'upload_date': '20201208',
  168. 'thumbnail': r're:^https?://.*\.jpg$',
  169. 'duration': 593,
  170. 'uploader': 'yorours',
  171. 'age_limit': 18,
  172. 'view_count': int,
  173. 'categories': list,
  174. 'tags': list,
  175. },
  176. }]
  177. _DOMAIN = 'www.playvids.com'
  178. def _get_detail(self, html):
  179. return get_element_by_class('detail-block', html)