]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/novamov.py
6af8d934c8baa18b457fe1bdc3e96f42b5a82588
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
12 class NovamovIE(InfoExtractor
):
13 _VALID_URL
= r
'http://(?:(?:www\.)?novamov\.com/video/|(?:(?:embed|www)\.)novamov\.com/embed\.php\?v=)(?P<videoid>[a-z\d]{13})'
16 'url': 'http://www.novamov.com/video/4rurhn9x446jj',
17 'file': '4rurhn9x446jj.flv',
18 'md5': '7205f346a52bbeba427603ba10d4b935',
20 'title': 'search engine optimization',
21 'description': 'search engine optimization is used to rank the web page in the google search engine'
23 'skip': '"Invalid token" errors abound (in web interface as well as youtube-dl, there is nothing we can do about it.)'
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 filekey
= self
._search
_regex
(
37 r
'flashvars\.filekey="(?P<filekey>[^"]+)";', page
, 'filekey')
39 title
= self
._html
_search
_regex
(
40 r
'(?s)<div class="v_tab blockborder rounded5" id="v_tab1">\s*<h3>([^<]+)</h3>',
41 page
, 'title', fatal
=False)
43 description
= self
._html
_search
_regex
(
44 r
'(?s)<div class="v_tab blockborder rounded5" id="v_tab1">\s*<h3>[^<]+</h3><p>([^<]+)</p>',
45 page
, 'description', fatal
=False)
47 api_response
= self
._download
_webpage
(
48 'http://www.novamov.com/api/player.api.php?key=%s&file=%s' % (filekey
, video_id
),
49 video_id
, 'Downloading video api response')
51 response
= compat_urlparse
.parse_qs(api_response
)
53 if 'error_msg' in response
:
54 raise ExtractorError('novamov returned error: %s' % response
['error_msg'][0], expected
=True)
56 video_url
= response
['url'][0]
62 'description': description