aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor
diff options
context:
space:
mode:
authorPierre Rudloff <contact@rudloff.pro>2013-09-18 00:07:04 +0200
committerPierre Rudloff <contact@rudloff.pro>2013-09-18 00:07:04 +0200
commitcc6943e86aef74bef767be7f4027ab6122c95d55 (patch)
treecc0e8d09b61a12585d967d934993521a93cf27ef /youtube_dl/extractor
parent8f77093262b9613fcba73a101eb403ea9b275a33 (diff)
Improvements
Diffstat (limited to 'youtube_dl/extractor')
-rw-r--r--youtube_dl/extractor/websurg.py27
1 files changed, 10 insertions, 17 deletions
diff --git a/youtube_dl/extractor/websurg.py b/youtube_dl/extractor/websurg.py
index 953bc9831..efc8029af 100644
--- a/youtube_dl/extractor/websurg.py
+++ b/youtube_dl/extractor/websurg.py
@@ -23,7 +23,7 @@ class WeBSurgIE(InfoExtractor):
_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 = {
'username': self._downloader.params['username'],
@@ -35,14 +35,13 @@ class WeBSurgIE(InfoExtractor):
self._LOGIN_URL, compat_urllib_parse.urlencode(login_form))
request.add_header(
'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=(.*);',
- login_results['Set-Cookie']).group(1)
- request = compat_urllib_request.Request(
- url, compat_urllib_parse.urlencode(login_form),
- {'Cookie': 'PHPSESSID=' + sessid + ';'})
- 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')
video_id = re.match(self._VALID_URL, url).group(1)
@@ -52,16 +51,10 @@ class WeBSurgIE(InfoExtractor):
self._downloader.report_warning(
u'Unable to log in: bad username/password')
return
-
return {'id': video_id,
- 'title' : re.search(
- r'property="og:title" content="(.*?)" />'
- , webpage).group(1),
- 'description': re.search(
- r'name="description" content="(.*?)" />', webpage).group(1),
+ 'title': self._og_search_title(webpage),
+ 'description': self._og_search_description(webpage),
'ext' : 'mp4',
'url' : url_info.group(1) + '/' + url_info.group(2),
- 'thumbnail': re.search(
- r'property="og:image" content="(.*?)" />', webpage
- ).group(1)
+ 'thumbnail': self._og_search_thumbnail(webpage)
}