summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorPhilipp Hagemeister <[email protected]>2013-10-15 02:11:33 +0200
committerPhilipp Hagemeister <[email protected]>2013-10-15 02:11:33 +0200
commit4f41664de8e0486127d8dd16168d829c26f79fdf (patch)
treeb89ad4f6c0d4eb1ae6b476b0c2257c132b8dc320
parenta4fd04158eb7e570a0b2d27f6d9b6b9360644807 (diff)
parent73b4fafd82256c66198b1670d1a6dccfaf5f782c (diff)
downloadyoutube-dl-4f41664de8e0486127d8dd16168d829c26f79fdf.tar.gz
youtube-dl-4f41664de8e0486127d8dd16168d829c26f79fdf.zip
Merge remote-tracking branch 'Rudloff/websurg'
-rw-r--r--youtube_dl/extractor/__init__.py1
-rw-r--r--youtube_dl/extractor/websurg.py58
2 files changed, 59 insertions, 0 deletions
diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py
index 14ba6f358..5f0e2ec9b 100644
--- a/youtube_dl/extractor/__init__.py
+++ b/youtube_dl/extractor/__init__.py
@@ -136,6 +136,7 @@ from .videopremium import VideoPremiumIE
from .vimeo import VimeoIE, VimeoChannelIE
from .vine import VineIE
from .wat import WatIE
+from .websurg import WeBSurgIE
from .weibo import WeiboIE
from .wimp import WimpIE
from .worldstarhiphop import WorldStarHipHopIE
diff --git a/youtube_dl/extractor/websurg.py b/youtube_dl/extractor/websurg.py
new file mode 100644
index 000000000..7d335d444
--- /dev/null
+++ b/youtube_dl/extractor/websurg.py
@@ -0,0 +1,58 @@
+# coding: utf-8
+
+import re
+
+from ..utils import (
+ compat_urllib_request,
+ compat_urllib_parse
+)
+
+from .common import InfoExtractor
+
+class WeBSurgIE(InfoExtractor):
+ IE_NAME = u'websurg.com'
+ _VALID_URL = r'http://.*?\.websurg\.com/MEDIA/\?noheader=1&doi=(.*)'
+
+ _TEST = {
+ u'url': u'http://www.websurg.com/MEDIA/?noheader=1&doi=vd01en4012',
+ u'file': u'vd01en4012.mp4',
+ u'params': {
+ u'skip_download': True,
+ }
+ }
+
+ _LOGIN_URL = 'http://www.websurg.com/inc/login/login_div.ajax.php?login=1'
+
+ def _real_initialize(self):
+
+ login_form = {
+ 'username': self._downloader.params['username'],
+ 'password': self._downloader.params['password'],
+ 'Submit': 1
+ }
+
+ request = compat_urllib_request.Request(
+ self._LOGIN_URL, compat_urllib_parse.urlencode(login_form))
+ request.add_header(
+ 'Content-Type', 'application/x-www-form-urlencoded;charset=utf-8')
+ compat_urllib_request.urlopen(request).info()
+ webpage = self._download_webpage(self._LOGIN_URL, '', 'Logging in')
+
+ 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)
+
+ webpage = self._download_webpage(url, video_id)
+
+ url_info = re.search(r'streamer="(.*?)" src="(.*?)"', webpage)
+
+ return {'id': video_id,
+ 'title': self._og_search_title(webpage),
+ 'description': self._og_search_description(webpage),
+ 'ext' : 'mp4',
+ 'url' : url_info.group(1) + '/' + url_info.group(2),
+ 'thumbnail': self._og_search_thumbnail(webpage)
+ }