peekvids.py 7.0 KB

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