Improvements

pull/8/head
Pierre Rudloff 11 years ago
parent 8f77093262
commit cc6943e86a

@ -23,7 +23,7 @@ class WeBSurgIE(InfoExtractor):
_LOGIN_URL = 'http://www.websurg.com/inc/login/login_div.ajax.php?login=1' _LOGIN_URL = 'http://www.websurg.com/inc/login/login_div.ajax.php?login=1'
def _real_extract(self, url): def _real_initialize(self):
login_form = { login_form = {
'username': self._downloader.params['username'], 'username': self._downloader.params['username'],
@ -35,14 +35,13 @@ class WeBSurgIE(InfoExtractor):
self._LOGIN_URL, compat_urllib_parse.urlencode(login_form)) self._LOGIN_URL, compat_urllib_parse.urlencode(login_form))
request.add_header( request.add_header(
'Content-Type', 'application/x-www-form-urlencoded;charset=utf-8') 'Content-Type', 'application/x-www-form-urlencoded;charset=utf-8')
login_results = compat_urllib_request.urlopen(request).info() compat_urllib_request.urlopen(request).info()
sessid = re.match(r'PHPSESSID=(.*);', def _real_extract(self, url):
login_results['Set-Cookie']).group(1)
request = compat_urllib_request.Request( request = compat_urllib_request.Request(url)
url, compat_urllib_parse.urlencode(login_form), webpage = unicode(
{'Cookie': 'PHPSESSID=' + sessid + ';'}) compat_urllib_request.urlopen(request).read(), 'utf-8')
webpage = compat_urllib_request.urlopen(request).read()
video_id = re.match(self._VALID_URL, url).group(1) video_id = re.match(self._VALID_URL, url).group(1)
@ -52,16 +51,10 @@ class WeBSurgIE(InfoExtractor):
self._downloader.report_warning( self._downloader.report_warning(
u'Unable to log in: bad username/password') u'Unable to log in: bad username/password')
return return
return {'id': video_id, return {'id': video_id,
'title' : re.search( 'title': self._og_search_title(webpage),
r'property="og:title" content="(.*?)" />' 'description': self._og_search_description(webpage),
, webpage).group(1),
'description': re.search(
r'name="description" content="(.*?)" />', webpage).group(1),
'ext' : 'mp4', 'ext' : 'mp4',
'url' : url_info.group(1) + '/' + url_info.group(2), 'url' : url_info.group(1) + '/' + url_info.group(2),
'thumbnail': re.search( 'thumbnail': self._og_search_thumbnail(webpage)
r'property="og:image" content="(.*?)" />', webpage
).group(1)
} }

Loading…
Cancel
Save