diff options
author | Pierre Rudloff <contact@rudloff.pro> | 2013-10-04 01:04:38 +0200 |
---|---|---|
committer | Pierre Rudloff <contact@rudloff.pro> | 2013-10-04 01:04:38 +0200 |
commit | 5c1d63b73737bb23885ae6079e2004b5f084eb9c (patch) | |
tree | cc6b4072c349e112b0baa0edb947dd809f40f413 /youtube_dl/extractor/websurg.py | |
parent | cc6943e86aef74bef767be7f4027ab6122c95d55 (diff) |
Changes suggested by @phihag
Diffstat (limited to 'youtube_dl/extractor/websurg.py')
-rw-r--r-- | youtube_dl/extractor/websurg.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/youtube_dl/extractor/websurg.py b/youtube_dl/extractor/websurg.py index efc8029af..849334aa0 100644 --- a/youtube_dl/extractor/websurg.py +++ b/youtube_dl/extractor/websurg.py @@ -36,21 +36,21 @@ class WeBSurgIE(InfoExtractor): request.add_header( 'Content-Type', 'application/x-www-form-urlencoded;charset=utf-8') compat_urllib_request.urlopen(request).info() + request = compat_urllib_request.Request(self._LOGIN_URL) + webpage = compat_urllib_request.urlopen(request).read() - def _real_extract(self, url): - - request = compat_urllib_request.Request(url) - webpage = unicode( - compat_urllib_request.urlopen(request).read(), 'utf-8') + if webpage != 'OK': + self._downloader.report_error( + u'Unable to log in: bad username/password') + def _real_extract(self, url): video_id = re.match(self._VALID_URL, url).group(1) + request = compat_urllib_request.Request(url) + webpage = self._download_webpage(url, video_id) + url_info = re.search(r'streamer="(.*?)" src="(.*?)"', webpage) - if url_info is None: - self._downloader.report_warning( - u'Unable to log in: bad username/password') - return return {'id': video_id, 'title': self._og_search_title(webpage), 'description': self._og_search_description(webpage), |