1 from __future__ import unicode_literals
5 from .common import InfoExtractor
11 class NovamovIE(InfoExtractor):
13 IE_DESC = 'novamov.com videos'
14 _VALID_URL = r'http://(?:www\.novamov\.com/video/|embed\.novamov\.com/embed\.php\?v=)(?P<videoid>[a-z\d]{13})'
17 'url': 'http://www.novamov.com/video/4rurhn9x446jj',
18 'file': '4rurhn9x446jj.flv',
19 'md5': '7205f346a52bbeba427603ba10d4b935',
21 'title': 'search engine optimization',
22 'description': 'search engine optimization is used to rank the web page in the google search engine'
26 def _real_extract(self, url):
27 mobj = re.match(self._VALID_URL, url)
28 video_id = mobj.group('videoid')
30 page = self._download_webpage('http://www.novamov.com/video/%s' % video_id,
31 video_id, 'Downloading video page')
33 if re.search(r'This file no longer exists on our servers!</h2>', page) is not None:
34 raise ExtractorError(u'Video %s does not exist' % video_id, expected=True)
36 mobj= re.search(r'flashvars\.filekey="(?P<filekey>[^"]+)";', page)
38 raise ExtractorError('Unable to extract filekey', expected=True)
40 filekey = mobj.group('filekey')
42 title = self._html_search_regex(
43 r'(?s)<div class="v_tab blockborder rounded5" id="v_tab1">\s*<h3>([^<]+)</h3>',
44 page, 'title', fatal=False)
46 description = self._html_search_regex(
47 r'(?s)<div class="v_tab blockborder rounded5" id="v_tab1">\s*<h3>[^<]+</h3><p>([^<]+)</p>',
48 page, 'description', fatal=False)
50 api_response = self._download_webpage('http://www.novamov.com/api/player.api.php?key=%s&file=%s' % (filekey, video_id),
51 video_id, 'Downloading video api response')
53 response = compat_urlparse.parse_qs(api_response)
55 if 'error_msg' in response:
56 raise ExtractorError('novamov returned error: %s' % response['error_msg'][0], expected=True)
58 video_url = response['url'][0]
64 'description': description