diff options
author | kkalpakloglou <kkalpakloglou@yahoo.com> | 2013-03-26 22:37:08 +0200 |
---|---|---|
committer | Filippo Valsorda <filippo.valsorda@gmail.com> | 2013-03-29 14:23:09 +0100 |
commit | 43113d92cc89cb6c9ff98a1b45512a92c71abb23 (patch) | |
tree | 1a83922d18e3cb380e6c936d084c9575111f73e9 /youtube_dl | |
parent | 95506f1235e835c4a86ec903154ce697dae6975a (diff) |
Update InfoExtractors.py
Diffstat (limited to 'youtube_dl')
-rwxr-xr-x | youtube_dl/InfoExtractors.py | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/youtube_dl/InfoExtractors.py b/youtube_dl/InfoExtractors.py index 8e164760b..eb1f32480 100755 --- a/youtube_dl/InfoExtractors.py +++ b/youtube_dl/InfoExtractors.py @@ -4160,6 +4160,46 @@ class SpiegelIE(InfoExtractor): } return [info] +class liveleakIE(InfoExtractor): + + _VALID_URL = r'^(?:http?://)?(?:\w+\.)?liveleak\.com/view\?(?:.*?)i=(?P<video_id>\d+)(?:.*)' + IE_NAME = u'liveleak' + + def _real_extract(self, url): + mobj = re.match(self._VALID_URL, url) + if mobj is None: + self._downloader.trouble(u'ERROR: invalid URL: %s' % url) + return + + video_id = mobj.group(1) + if video_id.endswith('/index.html'): + video_id = video_id[:-len('/index.html')] + + webpage = self._download_webpage(url, video_id) + + video_url = u'http://edge.liveleak.com/80281E/u/u/ll2_player_files/mp55/player.swf?config=http://www.liveleak.com/player?a=config%26item_token=' + video_id + m = re.search(r'<meta property="og:title" content="(?P<title>.*?)"', webpage) + if not m: + self._downloader.trouble(u'Cannot find video title') + title = unescapeHTML(m.group('title')) + + m = re.search(r'<meta property="og:description" content="(?P<desc>.*?)"', webpage) + if m: + desc = unescapeHTML(m.group('desc')) + else: + desc = None + + + info = { + 'id': video_id, + 'url': video_url, + 'ext': 'mp4', + 'title': title, + 'description': desc + } + + return [info] + def gen_extractors(): """ Return a list of an instance of every supported extractor. @@ -4210,7 +4250,6 @@ def gen_extractors(): TEDIE(), MySpassIE(), SpiegelIE(), + liveleakIE(), GenericIE() ] - - |