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.

212 lines
7.1 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
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
  1. from __future__ import unicode_literals
  2. import re
  3. from .common import InfoExtractor
  4. from ..compat import compat_urlparse
  5. from ..utils import (
  6. ExtractorError,
  7. NO_DEFAULT,
  8. sanitized_Request,
  9. urlencode_postdata,
  10. )
  11. class NovaMovIE(InfoExtractor):
  12. IE_NAME = 'novamov'
  13. IE_DESC = 'NovaMov'
  14. _VALID_URL_TEMPLATE = r'''(?x)
  15. http://
  16. (?:
  17. (?:www\.)?%(host)s/(?:file|video|mobile/\#/videos)/|
  18. (?:(?:embed|www)\.)%(host)s/embed(?:\.php|/)?\?(?:.*?&)?\bv=
  19. )
  20. (?P<id>[a-z\d]{13})
  21. '''
  22. _VALID_URL = _VALID_URL_TEMPLATE % {'host': 'novamov\.com'}
  23. _HOST = 'www.novamov.com'
  24. _FILE_DELETED_REGEX = r'This file no longer exists on our servers!</h2>'
  25. _FILEKEY_REGEX = r'flashvars\.filekey=(?P<filekey>"?[^"]+"?);'
  26. _TITLE_REGEX = r'(?s)<div class="v_tab blockborder rounded5" id="v_tab1">\s*<h3>([^<]+)</h3>'
  27. _DESCRIPTION_REGEX = r'(?s)<div class="v_tab blockborder rounded5" id="v_tab1">\s*<h3>[^<]+</h3><p>([^<]+)</p>'
  28. _URL_TEMPLATE = 'http://%s/video/%s'
  29. _TEST = None
  30. def _check_existence(self, webpage, video_id):
  31. if re.search(self._FILE_DELETED_REGEX, webpage) is not None:
  32. raise ExtractorError('Video %s does not exist' % video_id, expected=True)
  33. def _real_extract(self, url):
  34. video_id = self._match_id(url)
  35. url = self._URL_TEMPLATE % (self._HOST, video_id)
  36. webpage = self._download_webpage(
  37. url, video_id, 'Downloading video page')
  38. self._check_existence(webpage, video_id)
  39. def extract_filekey(default=NO_DEFAULT):
  40. filekey = self._search_regex(
  41. self._FILEKEY_REGEX, webpage, 'filekey', default=default)
  42. if filekey is not default and (filekey[0] != '"' or filekey[-1] != '"'):
  43. return self._search_regex(
  44. r'var\s+%s\s*=\s*"([^"]+)"' % re.escape(filekey), webpage, 'filekey', default=default)
  45. else:
  46. return filekey
  47. filekey = extract_filekey(default=None)
  48. if not filekey:
  49. fields = self._hidden_inputs(webpage)
  50. post_url = self._search_regex(
  51. r'<form[^>]+action=(["\'])(?P<url>.+?)\1', webpage,
  52. 'post url', default=url, group='url')
  53. if not post_url.startswith('http'):
  54. post_url = compat_urlparse.urljoin(url, post_url)
  55. request = sanitized_Request(
  56. post_url, urlencode_postdata(fields))
  57. request.add_header('Content-Type', 'application/x-www-form-urlencoded')
  58. request.add_header('Referer', post_url)
  59. webpage = self._download_webpage(
  60. request, video_id, 'Downloading continue to the video page')
  61. self._check_existence(webpage, video_id)
  62. filekey = extract_filekey()
  63. title = self._html_search_regex(self._TITLE_REGEX, webpage, 'title')
  64. description = self._html_search_regex(self._DESCRIPTION_REGEX, webpage, 'description', default='', fatal=False)
  65. api_response = self._download_webpage(
  66. 'http://%s/api/player.api.php?key=%s&file=%s' % (self._HOST, filekey, video_id), video_id,
  67. 'Downloading video api response')
  68. response = compat_urlparse.parse_qs(api_response)
  69. if 'error_msg' in response:
  70. raise ExtractorError('%s returned error: %s' % (self.IE_NAME, response['error_msg'][0]), expected=True)
  71. video_url = response['url'][0]
  72. return {
  73. 'id': video_id,
  74. 'url': video_url,
  75. 'title': title,
  76. 'description': description
  77. }
  78. class WholeCloudIE(NovaMovIE):
  79. IE_NAME = 'wholecloud'
  80. IE_DESC = 'WholeCloud'
  81. _VALID_URL = NovaMovIE._VALID_URL_TEMPLATE % {'host': '(?:wholecloud\.net|movshare\.(?:net|sx|ag))'}
  82. _HOST = 'www.wholecloud.net'
  83. _FILE_DELETED_REGEX = r'>This file no longer exists on our servers.<'
  84. _TITLE_REGEX = r'<strong>Title:</strong> ([^<]+)</p>'
  85. _DESCRIPTION_REGEX = r'<strong>Description:</strong> ([^<]+)</p>'
  86. _TEST = {
  87. 'url': 'http://www.wholecloud.net/video/559e28be54d96',
  88. 'md5': 'abd31a2132947262c50429e1d16c1bfd',
  89. 'info_dict': {
  90. 'id': '559e28be54d96',
  91. 'ext': 'flv',
  92. 'title': 'dissapeared image',
  93. 'description': 'optical illusion dissapeared image magic illusion',
  94. }
  95. }
  96. class NowVideoIE(NovaMovIE):
  97. IE_NAME = 'nowvideo'
  98. IE_DESC = 'NowVideo'
  99. _VALID_URL = NovaMovIE._VALID_URL_TEMPLATE % {'host': 'nowvideo\.(?:to|ch|ec|sx|eu|at|ag|co|li)'}
  100. _HOST = 'www.nowvideo.to'
  101. _FILE_DELETED_REGEX = r'>This file no longer exists on our servers.<'
  102. _TITLE_REGEX = r'<h4>([^<]+)</h4>'
  103. _DESCRIPTION_REGEX = r'</h4>\s*<p>([^<]+)</p>'
  104. _TEST = {
  105. 'url': 'http://www.nowvideo.sx/video/f1d6fce9a968b',
  106. 'md5': '12c82cad4f2084881d8bc60ee29df092',
  107. 'info_dict': {
  108. 'id': 'f1d6fce9a968b',
  109. 'ext': 'flv',
  110. 'title': 'youtubedl test video BaWjenozKc',
  111. 'description': 'Description',
  112. },
  113. }
  114. class VideoWeedIE(NovaMovIE):
  115. IE_NAME = 'videoweed'
  116. IE_DESC = 'VideoWeed'
  117. _VALID_URL = NovaMovIE._VALID_URL_TEMPLATE % {'host': 'videoweed\.(?:es|com)'}
  118. _HOST = 'www.videoweed.es'
  119. _FILE_DELETED_REGEX = r'>This file no longer exists on our servers.<'
  120. _TITLE_REGEX = r'<h1 class="text_shadow">([^<]+)</h1>'
  121. _URL_TEMPLATE = 'http://%s/file/%s'
  122. _TEST = {
  123. 'url': 'http://www.videoweed.es/file/b42178afbea14',
  124. 'md5': 'abd31a2132947262c50429e1d16c1bfd',
  125. 'info_dict': {
  126. 'id': 'b42178afbea14',
  127. 'ext': 'flv',
  128. 'title': 'optical illusion dissapeared image magic illusion',
  129. 'description': ''
  130. },
  131. }
  132. class CloudTimeIE(NovaMovIE):
  133. IE_NAME = 'cloudtime'
  134. IE_DESC = 'CloudTime'
  135. _VALID_URL = NovaMovIE._VALID_URL_TEMPLATE % {'host': 'cloudtime\.to'}
  136. _HOST = 'www.cloudtime.to'
  137. _FILE_DELETED_REGEX = r'>This file no longer exists on our servers.<'
  138. _TITLE_REGEX = r'<div[^>]+class=["\']video_det["\'][^>]*>\s*<strong>([^<]+)</strong>'
  139. _TEST = None
  140. class AuroraVidIE(NovaMovIE):
  141. IE_NAME = 'auroravid'
  142. IE_DESC = 'AuroraVid'
  143. _VALID_URL = NovaMovIE._VALID_URL_TEMPLATE % {'host': 'auroravid\.to'}
  144. _HOST = 'www.auroravid.to'
  145. _FILE_DELETED_REGEX = r'This file no longer exists on our servers!<'
  146. _TESTS = [{
  147. 'url': 'http://www.auroravid.to/video/4rurhn9x446jj',
  148. 'md5': '7205f346a52bbeba427603ba10d4b935',
  149. 'info_dict': {
  150. 'id': '4rurhn9x446jj',
  151. 'ext': 'flv',
  152. 'title': 'search engine optimization',
  153. 'description': 'search engine optimization is used to rank the web page in the google search engine'
  154. },
  155. 'skip': '"Invalid token" errors abound (in web interface as well as youtube-dl, there is nothing we can do about it.)'
  156. }, {
  157. 'url': 'http://www.auroravid.to/embed/?v=4rurhn9x446jj',
  158. 'only_matching': True,
  159. }]