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.

144 lines
4.8 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
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 ..compat import compat_urllib_parse
  6. from ..utils import (
  7. ExtractorError,
  8. encode_dict,
  9. int_or_none,
  10. sanitized_Request,
  11. )
  12. class XFileShareIE(InfoExtractor):
  13. IE_DESC = 'XFileShare based sites: GorillaVid.in, daclips.in, movpod.in, fastvideo.in, realvid.net, filehoot.com and vidto.me'
  14. _VALID_URL = r'''(?x)
  15. https?://(?P<host>(?:www\.)?
  16. (?:daclips\.in|gorillavid\.in|movpod\.in|fastvideo\.in|realvid\.net|filehoot\.com|vidto\.me|powerwatch\.pw))/
  17. (?:embed-)?(?P<id>[0-9a-zA-Z]+)(?:-[0-9]+x[0-9]+\.html)?
  18. '''
  19. _FILE_NOT_FOUND_REGEX = r'>(?:404 - )?File Not Found<'
  20. _TESTS = [{
  21. 'url': 'http://gorillavid.in/06y9juieqpmi',
  22. 'md5': '5ae4a3580620380619678ee4875893ba',
  23. 'info_dict': {
  24. 'id': '06y9juieqpmi',
  25. 'ext': 'flv',
  26. 'title': 'Rebecca Black My Moment Official Music Video Reaction-6GK87Rc8bzQ',
  27. 'thumbnail': 're:http://.*\.jpg',
  28. },
  29. }, {
  30. 'url': 'http://gorillavid.in/embed-z08zf8le23c6-960x480.html',
  31. 'only_matching': True,
  32. }, {
  33. 'url': 'http://daclips.in/3rso4kdn6f9m',
  34. 'md5': '1ad8fd39bb976eeb66004d3a4895f106',
  35. 'info_dict': {
  36. 'id': '3rso4kdn6f9m',
  37. 'ext': 'mp4',
  38. 'title': 'Micro Pig piglets ready on 16th July 2009-bG0PdrCdxUc',
  39. 'thumbnail': 're:http://.*\.jpg',
  40. }
  41. }, {
  42. # video with countdown timeout
  43. 'url': 'http://fastvideo.in/1qmdn1lmsmbw',
  44. 'md5': '8b87ec3f6564a3108a0e8e66594842ba',
  45. 'info_dict': {
  46. 'id': '1qmdn1lmsmbw',
  47. 'ext': 'mp4',
  48. 'title': 'Man of Steel - Trailer',
  49. 'thumbnail': 're:http://.*\.jpg',
  50. },
  51. }, {
  52. 'url': 'http://realvid.net/ctn2y6p2eviw',
  53. 'md5': 'b2166d2cf192efd6b6d764c18fd3710e',
  54. 'info_dict': {
  55. 'id': 'ctn2y6p2eviw',
  56. 'ext': 'flv',
  57. 'title': 'rdx 1955',
  58. 'thumbnail': 're:http://.*\.jpg',
  59. },
  60. }, {
  61. 'url': 'http://movpod.in/0wguyyxi1yca',
  62. 'only_matching': True,
  63. }, {
  64. 'url': 'http://filehoot.com/3ivfabn7573c.html',
  65. 'info_dict': {
  66. 'id': '3ivfabn7573c',
  67. 'ext': 'mp4',
  68. 'title': 'youtube-dl test video \'äBaW_jenozKc.mp4.mp4',
  69. 'thumbnail': 're:http://.*\.jpg',
  70. }
  71. }, {
  72. 'url': 'http://vidto.me/ku5glz52nqe1.html',
  73. 'info_dict': {
  74. 'id': 'ku5glz52nqe1',
  75. 'ext': 'mp4',
  76. 'title': 'test'
  77. }
  78. }, {
  79. 'url': 'http://powerwatch.pw/duecjibvicbu',
  80. 'info_dict': {
  81. 'id': 'duecjibvicbu',
  82. 'ext': 'mp4',
  83. 'title': 'Big Buck Bunny trailer',
  84. },
  85. }]
  86. def _real_extract(self, url):
  87. mobj = re.match(self._VALID_URL, url)
  88. video_id = mobj.group('id')
  89. url = 'http://%s/%s' % (mobj.group('host'), video_id)
  90. webpage = self._download_webpage(url, video_id)
  91. if re.search(self._FILE_NOT_FOUND_REGEX, webpage) is not None:
  92. raise ExtractorError('Video %s does not exist' % video_id, expected=True)
  93. fields = self._hidden_inputs(webpage)
  94. if fields['op'] == 'download1':
  95. countdown = int_or_none(self._search_regex(
  96. r'<span id="countdown_str">(?:[Ww]ait)?\s*<span id="cxc">(\d+)</span>\s*(?:seconds?)?</span>',
  97. webpage, 'countdown', default=None))
  98. if countdown:
  99. self._sleep(countdown, video_id)
  100. post = compat_urllib_parse.urlencode(encode_dict(fields))
  101. req = sanitized_Request(url, post)
  102. req.add_header('Content-type', 'application/x-www-form-urlencoded')
  103. webpage = self._download_webpage(req, video_id, 'Downloading video page')
  104. title = (self._search_regex(
  105. [r'style="z-index: [0-9]+;">([^<]+)</span>',
  106. r'<td nowrap>([^<]+)</td>',
  107. r'h4-fine[^>]*>([^<]+)<',
  108. r'>Watch (.+) ',
  109. r'<h2 class="video-page-head">([^<]+)</h2>'],
  110. webpage, 'title', default=None) or self._og_search_title(webpage)).strip()
  111. video_url = self._search_regex(
  112. [r'file\s*:\s*["\'](http[^"\']+)["\'],',
  113. r'file_link\s*=\s*\'(https?:\/\/[0-9a-zA-z.\/\-_]+)'],
  114. webpage, 'file url')
  115. thumbnail = self._search_regex(
  116. r'image\s*:\s*["\'](http[^"\']+)["\'],', webpage, 'thumbnail', default=None)
  117. formats = [{
  118. 'format_id': 'sd',
  119. 'url': video_url,
  120. 'quality': 1,
  121. }]
  122. return {
  123. 'id': video_id,
  124. 'title': title,
  125. 'thumbnail': thumbnail,
  126. 'formats': formats,
  127. }