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.

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