You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

127 lines
4.7 KiB

Switch codebase to use sanitized_Request instead of compat_urllib_request.Request [downloader/dash] Use sanitized_Request [downloader/http] Use sanitized_Request [atresplayer] Use sanitized_Request [bambuser] Use sanitized_Request [bliptv] Use sanitized_Request [brightcove] Use sanitized_Request [cbs] Use sanitized_Request [ceskatelevize] Use sanitized_Request [collegerama] Use sanitized_Request [extractor/common] Use sanitized_Request [crunchyroll] Use sanitized_Request [dailymotion] Use sanitized_Request [dcn] Use sanitized_Request [dramafever] Use sanitized_Request [dumpert] Use sanitized_Request [eitb] Use sanitized_Request [escapist] Use sanitized_Request [everyonesmixtape] Use sanitized_Request [extremetube] Use sanitized_Request [facebook] Use sanitized_Request [fc2] Use sanitized_Request [flickr] Use sanitized_Request [4tube] Use sanitized_Request [gdcvault] Use sanitized_Request [extractor/generic] Use sanitized_Request [hearthisat] Use sanitized_Request [hotnewhiphop] Use sanitized_Request [hypem] Use sanitized_Request [iprima] Use sanitized_Request [ivi] Use sanitized_Request [keezmovies] Use sanitized_Request [letv] Use sanitized_Request [lynda] Use sanitized_Request [metacafe] Use sanitized_Request [minhateca] Use sanitized_Request [miomio] Use sanitized_Request [meovideo] Use sanitized_Request [mofosex] Use sanitized_Request [moniker] Use sanitized_Request [mooshare] Use sanitized_Request [movieclips] Use sanitized_Request [mtv] Use sanitized_Request [myvideo] Use sanitized_Request [neteasemusic] Use sanitized_Request [nfb] Use sanitized_Request [niconico] Use sanitized_Request [noco] Use sanitized_Request [nosvideo] Use sanitized_Request [novamov] Use sanitized_Request [nowness] Use sanitized_Request [nuvid] Use sanitized_Request [played] Use sanitized_Request [pluralsight] Use sanitized_Request [pornhub] Use sanitized_Request [pornotube] Use sanitized_Request [primesharetv] Use sanitized_Request [promptfile] Use sanitized_Request [qqmusic] Use sanitized_Request [rtve] Use sanitized_Request [safari] Use sanitized_Request [sandia] Use sanitized_Request [shared] Use sanitized_Request [sharesix] Use sanitized_Request [sina] Use sanitized_Request [smotri] Use sanitized_Request [sohu] Use sanitized_Request [spankwire] Use sanitized_Request [sportdeutschland] Use sanitized_Request [streamcloud] Use sanitized_Request [streamcz] Use sanitized_Request [tapely] Use sanitized_Request [tube8] Use sanitized_Request [tubitv] Use sanitized_Request [twitch] Use sanitized_Request [twitter] Use sanitized_Request [udemy] Use sanitized_Request [vbox7] Use sanitized_Request [veoh] Use sanitized_Request [vessel] Use sanitized_Request [vevo] Use sanitized_Request [viddler] Use sanitized_Request [videomega] Use sanitized_Request [viewvster] Use sanitized_Request [viki] Use sanitized_Request [vk] Use sanitized_Request [vodlocker] Use sanitized_Request [voicerepublic] Use sanitized_Request [wistia] Use sanitized_Request [xfileshare] Use sanitized_Request [xtube] Use sanitized_Request [xvideos] Use sanitized_Request [yandexmusic] Use sanitized_Request [youku] Use sanitized_Request [youporn] Use sanitized_Request [youtube] Use sanitized_Request [patreon] Use sanitized_Request [extractor/common] Remove unused import [nfb] PEP 8
9 years ago
Switch codebase to use sanitized_Request instead of compat_urllib_request.Request [downloader/dash] Use sanitized_Request [downloader/http] Use sanitized_Request [atresplayer] Use sanitized_Request [bambuser] Use sanitized_Request [bliptv] Use sanitized_Request [brightcove] Use sanitized_Request [cbs] Use sanitized_Request [ceskatelevize] Use sanitized_Request [collegerama] Use sanitized_Request [extractor/common] Use sanitized_Request [crunchyroll] Use sanitized_Request [dailymotion] Use sanitized_Request [dcn] Use sanitized_Request [dramafever] Use sanitized_Request [dumpert] Use sanitized_Request [eitb] Use sanitized_Request [escapist] Use sanitized_Request [everyonesmixtape] Use sanitized_Request [extremetube] Use sanitized_Request [facebook] Use sanitized_Request [fc2] Use sanitized_Request [flickr] Use sanitized_Request [4tube] Use sanitized_Request [gdcvault] Use sanitized_Request [extractor/generic] Use sanitized_Request [hearthisat] Use sanitized_Request [hotnewhiphop] Use sanitized_Request [hypem] Use sanitized_Request [iprima] Use sanitized_Request [ivi] Use sanitized_Request [keezmovies] Use sanitized_Request [letv] Use sanitized_Request [lynda] Use sanitized_Request [metacafe] Use sanitized_Request [minhateca] Use sanitized_Request [miomio] Use sanitized_Request [meovideo] Use sanitized_Request [mofosex] Use sanitized_Request [moniker] Use sanitized_Request [mooshare] Use sanitized_Request [movieclips] Use sanitized_Request [mtv] Use sanitized_Request [myvideo] Use sanitized_Request [neteasemusic] Use sanitized_Request [nfb] Use sanitized_Request [niconico] Use sanitized_Request [noco] Use sanitized_Request [nosvideo] Use sanitized_Request [novamov] Use sanitized_Request [nowness] Use sanitized_Request [nuvid] Use sanitized_Request [played] Use sanitized_Request [pluralsight] Use sanitized_Request [pornhub] Use sanitized_Request [pornotube] Use sanitized_Request [primesharetv] Use sanitized_Request [promptfile] Use sanitized_Request [qqmusic] Use sanitized_Request [rtve] Use sanitized_Request [safari] Use sanitized_Request [sandia] Use sanitized_Request [shared] Use sanitized_Request [sharesix] Use sanitized_Request [sina] Use sanitized_Request [smotri] Use sanitized_Request [sohu] Use sanitized_Request [spankwire] Use sanitized_Request [sportdeutschland] Use sanitized_Request [streamcloud] Use sanitized_Request [streamcz] Use sanitized_Request [tapely] Use sanitized_Request [tube8] Use sanitized_Request [tubitv] Use sanitized_Request [twitch] Use sanitized_Request [twitter] Use sanitized_Request [udemy] Use sanitized_Request [vbox7] Use sanitized_Request [veoh] Use sanitized_Request [vessel] Use sanitized_Request [vevo] Use sanitized_Request [viddler] Use sanitized_Request [videomega] Use sanitized_Request [viewvster] Use sanitized_Request [viki] Use sanitized_Request [vk] Use sanitized_Request [vodlocker] Use sanitized_Request [voicerepublic] Use sanitized_Request [wistia] Use sanitized_Request [xfileshare] Use sanitized_Request [xtube] Use sanitized_Request [xvideos] Use sanitized_Request [yandexmusic] Use sanitized_Request [youku] Use sanitized_Request [youporn] Use sanitized_Request [youtube] Use sanitized_Request [patreon] Use sanitized_Request [extractor/common] Remove unused import [nfb] PEP 8
9 years ago
  1. from __future__ import unicode_literals
  2. import re
  3. from .common import InfoExtractor
  4. from ..compat import (
  5. compat_urllib_parse_unquote,
  6. compat_urllib_parse_urlparse,
  7. )
  8. from ..utils import (
  9. sanitized_Request,
  10. str_to_int,
  11. unified_strdate,
  12. )
  13. from ..aes import aes_decrypt_text
  14. class SpankwireIE(InfoExtractor):
  15. _VALID_URL = r'https?://(?:www\.)?(?P<url>spankwire\.com/[^/]*/video(?P<id>[0-9]+)/?)'
  16. _TESTS = [{
  17. # download URL pattern: */<height>P_<tbr>K_<video_id>.mp4
  18. 'url': 'http://www.spankwire.com/Buckcherry-s-X-Rated-Music-Video-Crazy-Bitch/video103545/',
  19. 'md5': '8bbfde12b101204b39e4b9fe7eb67095',
  20. 'info_dict': {
  21. 'id': '103545',
  22. 'ext': 'mp4',
  23. 'title': 'Buckcherry`s X Rated Music Video Crazy Bitch',
  24. 'description': 'Crazy Bitch X rated music video.',
  25. 'uploader': 'oreusz',
  26. 'uploader_id': '124697',
  27. 'upload_date': '20070507',
  28. 'age_limit': 18,
  29. }
  30. }, {
  31. # download URL pattern: */mp4_<format_id>_<video_id>.mp4
  32. 'url': 'http://www.spankwire.com/Titcums-Compiloation-I/video1921551/',
  33. 'md5': '09b3c20833308b736ae8902db2f8d7e6',
  34. 'info_dict': {
  35. 'id': '1921551',
  36. 'ext': 'mp4',
  37. 'title': 'Titcums Compiloation I',
  38. 'description': 'cum on tits',
  39. 'uploader': 'dannyh78999',
  40. 'uploader_id': '3056053',
  41. 'upload_date': '20150822',
  42. 'age_limit': 18,
  43. },
  44. }]
  45. def _real_extract(self, url):
  46. mobj = re.match(self._VALID_URL, url)
  47. video_id = mobj.group('id')
  48. req = sanitized_Request('http://www.' + mobj.group('url'))
  49. req.add_header('Cookie', 'age_verified=1')
  50. webpage = self._download_webpage(req, video_id)
  51. title = self._html_search_regex(
  52. r'<h1>([^<]+)', webpage, 'title')
  53. description = self._html_search_regex(
  54. r'(?s)<div\s+id="descriptionContent">(.+?)</div>',
  55. webpage, 'description', fatal=False)
  56. thumbnail = self._html_search_regex(
  57. r'playerData\.screenShot\s*=\s*["\']([^"\']+)["\']',
  58. webpage, 'thumbnail', fatal=False)
  59. uploader = self._html_search_regex(
  60. r'by:\s*<a [^>]*>(.+?)</a>',
  61. webpage, 'uploader', fatal=False)
  62. uploader_id = self._html_search_regex(
  63. r'by:\s*<a href="/(?:user/viewProfile|Profile\.aspx)\?.*?UserId=(\d+).*?"',
  64. webpage, 'uploader id', fatal=False)
  65. upload_date = unified_strdate(self._html_search_regex(
  66. r'</a> on (.+?) at \d+:\d+',
  67. webpage, 'upload date', fatal=False))
  68. view_count = str_to_int(self._html_search_regex(
  69. r'<div id="viewsCounter"><span>([\d,\.]+)</span> views</div>',
  70. webpage, 'view count', fatal=False))
  71. comment_count = str_to_int(self._html_search_regex(
  72. r'<span\s+id="spCommentCount"[^>]*>([\d,\.]+)</span>',
  73. webpage, 'comment count', fatal=False))
  74. videos = re.findall(
  75. r'playerData\.cdnPath([0-9]{3,})\s*=\s*(?:encodeURIComponent\()?["\']([^"\']+)["\']', webpage)
  76. heights = [int(video[0]) for video in videos]
  77. video_urls = list(map(compat_urllib_parse_unquote, [video[1] for video in videos]))
  78. if webpage.find('flashvars\.encrypted = "true"') != -1:
  79. password = self._search_regex(
  80. r'flashvars\.video_title = "([^"]+)',
  81. webpage, 'password').replace('+', ' ')
  82. video_urls = list(map(
  83. lambda s: aes_decrypt_text(s, password, 32).decode('utf-8'),
  84. video_urls))
  85. formats = []
  86. for height, video_url in zip(heights, video_urls):
  87. path = compat_urllib_parse_urlparse(video_url).path
  88. m = re.search(r'/(?P<height>\d+)[pP]_(?P<tbr>\d+)[kK]', path)
  89. if m:
  90. tbr = int(m.group('tbr'))
  91. height = int(m.group('height'))
  92. else:
  93. tbr = None
  94. formats.append({
  95. 'url': video_url,
  96. 'format_id': '%dp' % height,
  97. 'height': height,
  98. 'tbr': tbr,
  99. })
  100. self._sort_formats(formats)
  101. age_limit = self._rta_search(webpage)
  102. return {
  103. 'id': video_id,
  104. 'title': title,
  105. 'description': description,
  106. 'thumbnail': thumbnail,
  107. 'uploader': uploader,
  108. 'uploader_id': uploader_id,
  109. 'upload_date': upload_date,
  110. 'view_count': view_count,
  111. 'comment_count': comment_count,
  112. 'formats': formats,
  113. 'age_limit': age_limit,
  114. }