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.

166 lines
5.5 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
10 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. # coding: utf-8
  2. from __future__ import unicode_literals
  3. import re
  4. from .common import InfoExtractor
  5. from ..utils import (
  6. decode_packed_codes,
  7. ExtractorError,
  8. int_or_none,
  9. NO_DEFAULT,
  10. sanitized_Request,
  11. urlencode_postdata,
  12. )
  13. class XFileShareIE(InfoExtractor):
  14. _SITES = (
  15. ('daclips.in', 'DaClips'),
  16. ('filehoot.com', 'FileHoot'),
  17. ('gorillavid.in', 'GorillaVid'),
  18. ('movpod.in', 'MovPod'),
  19. ('powerwatch.pw', 'PowerWatch'),
  20. ('rapidvideo.ws', 'Rapidvideo.ws'),
  21. ('thevideobee.to', 'TheVideoBee'),
  22. ('vidto.me', 'Vidto'),
  23. ('streamin.to', 'Streamin.To'),
  24. ('xvidstage.com', 'XVIDSTAGE'),
  25. )
  26. IE_DESC = 'XFileShare based sites: %s' % ', '.join(list(zip(*_SITES))[1])
  27. _VALID_URL = (r'https?://(?P<host>(?:www\.)?(?:%s))/(?:embed-)?(?P<id>[0-9a-zA-Z]+)'
  28. % '|'.join(re.escape(site) for site in list(zip(*_SITES))[0]))
  29. _FILE_NOT_FOUND_REGEXES = (
  30. r'>(?:404 - )?File Not Found<',
  31. r'>The file was removed by administrator<',
  32. )
  33. _TESTS = [{
  34. 'url': 'http://gorillavid.in/06y9juieqpmi',
  35. 'md5': '5ae4a3580620380619678ee4875893ba',
  36. 'info_dict': {
  37. 'id': '06y9juieqpmi',
  38. 'ext': 'mp4',
  39. 'title': 'Rebecca Black My Moment Official Music Video Reaction-6GK87Rc8bzQ',
  40. 'thumbnail': r're:http://.*\.jpg',
  41. },
  42. }, {
  43. 'url': 'http://gorillavid.in/embed-z08zf8le23c6-960x480.html',
  44. 'only_matching': True,
  45. }, {
  46. 'url': 'http://daclips.in/3rso4kdn6f9m',
  47. 'md5': '1ad8fd39bb976eeb66004d3a4895f106',
  48. 'info_dict': {
  49. 'id': '3rso4kdn6f9m',
  50. 'ext': 'mp4',
  51. 'title': 'Micro Pig piglets ready on 16th July 2009-bG0PdrCdxUc',
  52. 'thumbnail': r're:http://.*\.jpg',
  53. }
  54. }, {
  55. 'url': 'http://movpod.in/0wguyyxi1yca',
  56. 'only_matching': True,
  57. }, {
  58. 'url': 'http://filehoot.com/3ivfabn7573c.html',
  59. 'info_dict': {
  60. 'id': '3ivfabn7573c',
  61. 'ext': 'mp4',
  62. 'title': 'youtube-dl test video \'äBaW_jenozKc.mp4.mp4',
  63. 'thumbnail': r're:http://.*\.jpg',
  64. },
  65. 'skip': 'Video removed',
  66. }, {
  67. 'url': 'http://vidto.me/ku5glz52nqe1.html',
  68. 'info_dict': {
  69. 'id': 'ku5glz52nqe1',
  70. 'ext': 'mp4',
  71. 'title': 'test'
  72. }
  73. }, {
  74. 'url': 'http://powerwatch.pw/duecjibvicbu',
  75. 'info_dict': {
  76. 'id': 'duecjibvicbu',
  77. 'ext': 'mp4',
  78. 'title': 'Big Buck Bunny trailer',
  79. },
  80. }, {
  81. 'url': 'http://xvidstage.com/e0qcnl03co6z',
  82. 'info_dict': {
  83. 'id': 'e0qcnl03co6z',
  84. 'ext': 'mp4',
  85. 'title': 'Chucky Prank 2015.mp4',
  86. },
  87. }, {
  88. # removed by administrator
  89. 'url': 'http://xvidstage.com/amfy7atlkx25',
  90. 'only_matching': True,
  91. }]
  92. def _real_extract(self, url):
  93. mobj = re.match(self._VALID_URL, url)
  94. video_id = mobj.group('id')
  95. url = 'http://%s/%s' % (mobj.group('host'), video_id)
  96. webpage = self._download_webpage(url, video_id)
  97. if any(re.search(p, webpage) for p in self._FILE_NOT_FOUND_REGEXES):
  98. raise ExtractorError('Video %s does not exist' % video_id, expected=True)
  99. fields = self._hidden_inputs(webpage)
  100. if fields['op'] == 'download1':
  101. countdown = int_or_none(self._search_regex(
  102. r'<span id="countdown_str">(?:[Ww]ait)?\s*<span id="cxc">(\d+)</span>\s*(?:seconds?)?</span>',
  103. webpage, 'countdown', default=None))
  104. if countdown:
  105. self._sleep(countdown, video_id)
  106. post = urlencode_postdata(fields)
  107. req = sanitized_Request(url, post)
  108. req.add_header('Content-type', 'application/x-www-form-urlencoded')
  109. webpage = self._download_webpage(req, video_id, 'Downloading video page')
  110. title = (self._search_regex(
  111. (r'style="z-index: [0-9]+;">([^<]+)</span>',
  112. r'<td nowrap>([^<]+)</td>',
  113. r'h4-fine[^>]*>([^<]+)<',
  114. r'>Watch (.+) ',
  115. r'<h2 class="video-page-head">([^<]+)</h2>',
  116. r'<h2 style="[^"]*color:#403f3d[^"]*"[^>]*>([^<]+)<'), # streamin.to
  117. webpage, 'title', default=None) or self._og_search_title(
  118. webpage, default=None) or video_id).strip()
  119. def extract_video_url(default=NO_DEFAULT):
  120. return self._search_regex(
  121. (r'file\s*:\s*(["\'])(?P<url>http.+?)\1,',
  122. r'file_link\s*=\s*(["\'])(?P<url>http.+?)\1',
  123. r'addVariable\((\\?["\'])file\1\s*,\s*(\\?["\'])(?P<url>http.+?)\2\)',
  124. r'<embed[^>]+src=(["\'])(?P<url>http.+?)\1'),
  125. webpage, 'file url', default=default, group='url')
  126. video_url = extract_video_url(default=None)
  127. if not video_url:
  128. webpage = decode_packed_codes(self._search_regex(
  129. r"(}\('(.+)',(\d+),(\d+),'[^']*\b(?:file|embed)\b[^']*'\.split\('\|'\))",
  130. webpage, 'packed code'))
  131. video_url = extract_video_url()
  132. thumbnail = self._search_regex(
  133. r'image\s*:\s*["\'](http[^"\']+)["\'],', webpage, 'thumbnail', default=None)
  134. formats = [{
  135. 'format_id': 'sd',
  136. 'url': video_url,
  137. 'quality': 1,
  138. }]
  139. return {
  140. 'id': video_id,
  141. 'title': title,
  142. 'thumbnail': thumbnail,
  143. 'formats': formats,
  144. }