]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/websurg.py
10 from .common
import InfoExtractor
12 class WeBSurgIE(InfoExtractor
):
13 IE_NAME
= u
'websurg.com'
14 _VALID_URL
= r
'http://.*?\.websurg\.com/MEDIA/\?noheader=1&doi=(.*)'
17 u
'url': u
'http://www.websurg.com/MEDIA/?noheader=1&doi=vd01en4012',
18 u
'file': u
'vd01en4012.mp4',
20 u
'skip_download': True,
22 u
'skip': u
'Requires login information',
25 _LOGIN_URL
= 'http://www.websurg.com/inc/login/login_div.ajax.php?login=1'
27 def _real_initialize(self
):
30 'username': self
._downloader
.params
['username'],
31 'password': self
._downloader
.params
['password'],
35 request
= compat_urllib_request
.Request(
36 self
._LOGIN
_URL
, compat_urllib_parse
.urlencode(login_form
))
38 'Content-Type', 'application/x-www-form-urlencoded;charset=utf-8')
39 compat_urllib_request
.urlopen(request
).info()
40 webpage
= self
._download
_webpage
(self
._LOGIN
_URL
, '', 'Logging in')
43 self
._downloader
.report_error(
44 u
'Unable to log in: bad username/password')
46 def _real_extract(self
, url
):
47 video_id
= re
.match(self
._VALID
_URL
, url
).group(1)
49 webpage
= self
._download
_webpage
(url
, video_id
)
51 url_info
= re
.search(r
'streamer="(.*?)" src="(.*?)"', webpage
)
53 return {'id': video_id
,
54 'title': self
._og
_search
_title
(webpage
),
55 'description': self
._og
_search
_description
(webpage
),
57 'url' : url_info
.group(1) + '/' + url_info
.group(2),
58 'thumbnail': self
._og
_search
_thumbnail
(webpage
)