1 from __future__ import unicode_literals
5 from .common import InfoExtractor
6 from ..compat import compat_urlparse
15 class NovaMovIE(InfoExtractor):
19 _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})'
20 _VALID_URL = _VALID_URL_TEMPLATE % {'host': 'novamov\.com'}
22 _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'
32 def _check_existence(self, webpage, video_id):
33 if re.search(self._FILE_DELETED_REGEX, webpage) is not None:
34 raise ExtractorError('Video %s does not exist' % video_id, expected=True)
36 def _real_extract(self, url):
37 video_id = self._match_id(url)
39 url = self._URL_TEMPLATE % (self._HOST, video_id)
41 webpage = self._download_webpage(
42 url, video_id, 'Downloading video page')
44 self._check_existence(webpage, video_id)
46 def extract_filekey(default=NO_DEFAULT):
47 filekey = self._search_regex(
48 self._FILEKEY_REGEX, webpage, 'filekey', default=default)
49 if filekey is not default and (filekey[0] != '"' or filekey[-1] != '"'):
50 return self._search_regex(
51 r'var\s+%s\s*=\s*"([^"]+)"' % re.escape(filekey), webpage, 'filekey', default=default)
55 filekey = extract_filekey(default=None)
58 fields = self._hidden_inputs(webpage)
59 post_url = self._search_regex(
60 r'<form[^>]+action=(["\'])(?P<url>.+?)\1', webpage,
61 'post url', default=url, group='url')
62 if not post_url.startswith('http'):
63 post_url = compat_urlparse.urljoin(url, post_url)
64 request = sanitized_Request(
65 post_url, urlencode_postdata(fields))
66 request.add_header('Content-Type', 'application/x-www-form-urlencoded')
67 request.add_header('Referer', post_url)
68 webpage = self._download_webpage(
69 request, video_id, 'Downloading continue to the video page')
70 self._check_existence(webpage, video_id)
72 filekey = extract_filekey()
74 title = self._html_search_regex(self._TITLE_REGEX, webpage, 'title')
75 description = self._html_search_regex(self._DESCRIPTION_REGEX, webpage, 'description', default='', fatal=False)
77 api_response = self._download_webpage(
78 'http://%s/api/player.api.php?key=%s&file=%s' % (self._HOST, filekey, video_id), video_id,
79 'Downloading video api response')
81 response = compat_urlparse.parse_qs(api_response)
83 if 'error_msg' in response:
84 raise ExtractorError('%s returned error: %s' % (self.IE_NAME, response['error_msg'][0]), expected=True)
86 video_url = response['url'][0]
92 'description': description
96 class WholeCloudIE(NovaMovIE):
97 IE_NAME = 'wholecloud'
98 IE_DESC = 'WholeCloud'
100 _VALID_URL = NovaMovIE._VALID_URL_TEMPLATE % {'host': '(?:wholecloud\.net|movshare\.(?:net|sx|ag))'}
102 _HOST = 'www.wholecloud.net'
104 _FILE_DELETED_REGEX = r'>This file no longer exists on our servers.<'
105 _TITLE_REGEX = r'<strong>Title:</strong> ([^<]+)</p>'
106 _DESCRIPTION_REGEX = r'<strong>Description:</strong> ([^<]+)</p>'
109 'url': 'http://www.wholecloud.net/video/559e28be54d96',
110 'md5': 'abd31a2132947262c50429e1d16c1bfd',
112 'id': '559e28be54d96',
114 'title': 'dissapeared image',
115 'description': 'optical illusion dissapeared image magic illusion',
120 class NowVideoIE(NovaMovIE):
124 _VALID_URL = NovaMovIE._VALID_URL_TEMPLATE % {'host': 'nowvideo\.(?:to|ch|ec|sx|eu|at|ag|co|li)'}
126 _HOST = 'www.nowvideo.to'
128 _FILE_DELETED_REGEX = r'>This file no longer exists on our servers.<'
129 _TITLE_REGEX = r'<h4>([^<]+)</h4>'
130 _DESCRIPTION_REGEX = r'</h4>\s*<p>([^<]+)</p>'
133 'url': 'http://www.nowvideo.sx/video/f1d6fce9a968b',
134 'md5': '12c82cad4f2084881d8bc60ee29df092',
136 'id': 'f1d6fce9a968b',
138 'title': 'youtubedl test video BaWjenozKc',
139 'description': 'Description',
144 class VideoWeedIE(NovaMovIE):
145 IE_NAME = 'videoweed'
146 IE_DESC = 'VideoWeed'
148 _VALID_URL = NovaMovIE._VALID_URL_TEMPLATE % {'host': 'videoweed\.(?:es|com)'}
150 _HOST = 'www.videoweed.es'
152 _FILE_DELETED_REGEX = r'>This file no longer exists on our servers.<'
153 _TITLE_REGEX = r'<h1 class="text_shadow">([^<]+)</h1>'
154 _URL_TEMPLATE = 'http://%s/file/%s'
157 'url': 'http://www.videoweed.es/file/b42178afbea14',
158 'md5': 'abd31a2132947262c50429e1d16c1bfd',
160 'id': 'b42178afbea14',
162 'title': 'optical illusion dissapeared image magic illusion',
168 class CloudTimeIE(NovaMovIE):
169 IE_NAME = 'cloudtime'
170 IE_DESC = 'CloudTime'
172 _VALID_URL = NovaMovIE._VALID_URL_TEMPLATE % {'host': 'cloudtime\.to'}
174 _HOST = 'www.cloudtime.to'
176 _FILE_DELETED_REGEX = r'>This file no longer exists on our servers.<'
177 _TITLE_REGEX = r'<div[^>]+class=["\']video_det["\'][^>]*>\s*<strong>([^<]+)</strong>'
182 class AuroraVidIE(NovaMovIE):
183 IE_NAME = 'auroravid'
184 IE_DESC = 'AuroraVid'
186 _VALID_URL = NovaMovIE._VALID_URL_TEMPLATE % {'host': 'auroravid\.to'}
188 _HOST = 'www.auroravid.to'
190 _FILE_DELETED_REGEX = r'This file no longer exists on our servers!<'
193 'url': 'http://www.auroravid.to/video/4rurhn9x446jj',
194 'md5': '7205f346a52bbeba427603ba10d4b935',
196 'id': '4rurhn9x446jj',
198 'title': 'search engine optimization',
199 'description': 'search engine optimization is used to rank the web page in the google search engine'
201 'skip': '"Invalid token" errors abound (in web interface as well as youtube-dl, there is nothing we can do about it.)'