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.

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