]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/nowvideo.py
241cc160b9ca58bfc6b88bf9c12fe134df3b3d66
3 from .common
import InfoExtractor
4 from ..utils
import compat_urlparse
7 class NowVideoIE(InfoExtractor
):
8 _VALID_URL
= r
'(?:https?://)?(?:www\.)?nowvideo\.ch/video/(?P<id>\w+)'
10 u
'url': u
'http://www.nowvideo.ch/video/0mw0yow7b6dxa',
11 u
'file': u
'0mw0yow7b6dxa.flv',
12 u
'md5': u
'f8fbbc8add72bd95b7850c6a02fc8817',
14 u
"title": u
"youtubedl test video _BaW_jenozKc.mp4"
18 def _real_extract(self
, url
):
19 mobj
= re
.match(self
._VALID
_URL
, url
)
21 video_id
= mobj
.group('id')
22 webpage_url
= 'http://www.nowvideo.ch/video/' + video_id
23 embed_url
= 'http://embed.nowvideo.ch/embed.php?v=' + video_id
24 webpage
= self
._download
_webpage
(webpage_url
, video_id
)
25 embed_page
= self
._download
_webpage
(embed_url
, video_id
,
26 u
'Downloading embed page')
28 self
.report_extraction(video_id
)
30 video_title
= self
._html
_search
_regex
(r
'<h4>(.*)</h4>',
31 webpage
, u
'video title')
33 video_key
= self
._search
_regex
(r
'var fkzd="(.*)";',
34 embed_page
, u
'video key')
36 api_call
= "http://www.nowvideo.ch/api/player.api.php?file={0}&numOfErrors=0&cid=1&key={1}".format(video_id
, video_key
)
37 api_response
= self
._download
_webpage
(api_call
, video_id
,
38 u
'Downloading API page')
39 video_url
= compat_urlparse
.parse_qs(api_response
)[u
'url'][0]