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.

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