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.

180 lines
6.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. 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)/|(?:(?: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. _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 _real_extract(self, url):
  34. video_id = self._match_id(url)
  35. url = 'http://%s/video/%s' % (self._HOST, video_id)
  36. webpage = self._download_webpage(
  37. url, video_id, 'Downloading video page')
  38. if re.search(self._FILE_DELETED_REGEX, webpage) is not None:
  39. raise ExtractorError('Video %s does not exist' % video_id, expected=True)
  40. def extract_filekey(default=NO_DEFAULT):
  41. return self._search_regex(
  42. self._FILEKEY_REGEX, webpage, 'filekey', default=default)
  43. filekey = extract_filekey(default=None)
  44. if not filekey:
  45. fields = self._hidden_inputs(webpage)
  46. post_url = self._search_regex(
  47. r'<form[^>]+action=(["\'])(?P<url>.+?)\1', webpage,
  48. 'post url', default=url, group='url')
  49. if not post_url.startswith('http'):
  50. post_url = compat_urlparse.urljoin(url, post_url)
  51. request = sanitized_Request(
  52. post_url, urlencode_postdata(encode_dict(fields)))
  53. request.add_header('Content-Type', 'application/x-www-form-urlencoded')
  54. request.add_header('Referer', post_url)
  55. webpage = self._download_webpage(
  56. request, video_id, 'Downloading continue to the video page')
  57. filekey = extract_filekey()
  58. title = self._html_search_regex(self._TITLE_REGEX, webpage, 'title', fatal=False)
  59. description = self._html_search_regex(self._DESCRIPTION_REGEX, webpage, 'description', default='', fatal=False)
  60. api_response = self._download_webpage(
  61. 'http://%s/api/player.api.php?key=%s&file=%s' % (self._HOST, filekey, video_id), video_id,
  62. 'Downloading video api response')
  63. response = compat_urlparse.parse_qs(api_response)
  64. if 'error_msg' in response:
  65. raise ExtractorError('%s returned error: %s' % (self.IE_NAME, response['error_msg'][0]), expected=True)
  66. video_url = response['url'][0]
  67. return {
  68. 'id': video_id,
  69. 'url': video_url,
  70. 'title': title,
  71. 'description': description
  72. }
  73. class WholeCloudIE(NovaMovIE):
  74. IE_NAME = 'wholecloud'
  75. IE_DESC = 'WholeCloud'
  76. _VALID_URL = NovaMovIE._VALID_URL_TEMPLATE % {'host': '(?:wholecloud\.net|movshare\.(?:net|sx|ag))'}
  77. _HOST = 'www.wholecloud.net'
  78. _FILE_DELETED_REGEX = r'>This file no longer exists on our servers.<'
  79. _TITLE_REGEX = r'<strong>Title:</strong> ([^<]+)</p>'
  80. _DESCRIPTION_REGEX = r'<strong>Description:</strong> ([^<]+)</p>'
  81. _TEST = {
  82. 'url': 'http://www.wholecloud.net/video/559e28be54d96',
  83. 'md5': 'abd31a2132947262c50429e1d16c1bfd',
  84. 'info_dict': {
  85. 'id': '559e28be54d96',
  86. 'ext': 'flv',
  87. 'title': 'dissapeared image',
  88. 'description': 'optical illusion dissapeared image magic illusion',
  89. }
  90. }
  91. class NowVideoIE(NovaMovIE):
  92. IE_NAME = 'nowvideo'
  93. IE_DESC = 'NowVideo'
  94. _VALID_URL = NovaMovIE._VALID_URL_TEMPLATE % {'host': 'nowvideo\.(?:to|ch|ec|sx|eu|at|ag|co|li)'}
  95. _HOST = 'www.nowvideo.to'
  96. _FILE_DELETED_REGEX = r'>This file no longer exists on our servers.<'
  97. _FILEKEY_REGEX = r'var fkzd="([^"]+)";'
  98. _TITLE_REGEX = r'<h4>([^<]+)</h4>'
  99. _DESCRIPTION_REGEX = r'</h4>\s*<p>([^<]+)</p>'
  100. _TEST = {
  101. 'url': 'http://www.nowvideo.to/video/0mw0yow7b6dxa',
  102. 'md5': 'f8fbbc8add72bd95b7850c6a02fc8817',
  103. 'info_dict': {
  104. 'id': '0mw0yow7b6dxa',
  105. 'ext': 'flv',
  106. 'title': 'youtubedl test video _BaW_jenozKc.mp4',
  107. 'description': 'Description',
  108. }
  109. }
  110. class VideoWeedIE(NovaMovIE):
  111. IE_NAME = 'videoweed'
  112. IE_DESC = 'VideoWeed'
  113. _VALID_URL = NovaMovIE._VALID_URL_TEMPLATE % {'host': 'videoweed\.(?:es|com)'}
  114. _HOST = 'www.videoweed.es'
  115. _FILE_DELETED_REGEX = r'>This file no longer exists on our servers.<'
  116. _TITLE_REGEX = r'<h1 class="text_shadow">([^<]+)</h1>'
  117. _TEST = {
  118. 'url': 'http://www.videoweed.es/file/b42178afbea14',
  119. 'md5': 'abd31a2132947262c50429e1d16c1bfd',
  120. 'info_dict': {
  121. 'id': 'b42178afbea14',
  122. 'ext': 'flv',
  123. 'title': 'optical illusion dissapeared image magic illusion',
  124. 'description': ''
  125. },
  126. }
  127. class CloudTimeIE(NovaMovIE):
  128. IE_NAME = 'cloudtime'
  129. IE_DESC = 'CloudTime'
  130. _VALID_URL = NovaMovIE._VALID_URL_TEMPLATE % {'host': 'cloudtime\.to'}
  131. _HOST = 'www.cloudtime.to'
  132. _FILE_DELETED_REGEX = r'>This file no longer exists on our servers.<'
  133. _TITLE_REGEX = r'<div[^>]+class=["\']video_det["\'][^>]*>\s*<strong>([^<]+)</strong>'
  134. _TEST = None