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.

136 lines
4.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
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))/
  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. def _real_extract(self, url):
  80. mobj = re.match(self._VALID_URL, url)
  81. video_id = mobj.group('id')
  82. url = 'http://%s/%s' % (mobj.group('host'), video_id)
  83. webpage = self._download_webpage(url, video_id)
  84. if re.search(self._FILE_NOT_FOUND_REGEX, webpage) is not None:
  85. raise ExtractorError('Video %s does not exist' % video_id, expected=True)
  86. fields = self._hidden_inputs(webpage)
  87. if fields['op'] == 'download1':
  88. countdown = int_or_none(self._search_regex(
  89. r'<span id="countdown_str">(?:[Ww]ait)?\s*<span id="cxc">(\d+)</span>\s*(?:seconds?)?</span>',
  90. webpage, 'countdown', default=None))
  91. if countdown:
  92. self._sleep(countdown, video_id)
  93. post = compat_urllib_parse.urlencode(encode_dict(fields))
  94. req = sanitized_Request(url, post)
  95. req.add_header('Content-type', 'application/x-www-form-urlencoded')
  96. webpage = self._download_webpage(req, video_id, 'Downloading video page')
  97. title = (self._search_regex(
  98. [r'style="z-index: [0-9]+;">([^<]+)</span>',
  99. r'<td nowrap>([^<]+)</td>',
  100. r'>Watch (.+) ',
  101. r'<h2 class="video-page-head">([^<]+)</h2>'],
  102. webpage, 'title', default=None) or self._og_search_title(webpage)).strip()
  103. video_url = self._search_regex(
  104. [r'file\s*:\s*["\'](http[^"\']+)["\'],',
  105. r'file_link\s*=\s*\'(https?:\/\/[0-9a-zA-z.\/\-_]+)'],
  106. webpage, 'file url')
  107. thumbnail = self._search_regex(
  108. r'image\s*:\s*["\'](http[^"\']+)["\'],', webpage, 'thumbnail', default=None)
  109. formats = [{
  110. 'format_id': 'sd',
  111. 'url': video_url,
  112. 'quality': 1,
  113. }]
  114. return {
  115. 'id': video_id,
  116. 'title': title,
  117. 'thumbnail': thumbnail,
  118. 'formats': formats,
  119. }