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.

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