Rebased, fixed and extended LiveLeak.com support

close #757 - close #761
This commit is contained in:
Filippo Valsorda 2013-03-29 15:13:24 +01:00
parent 43113d92cc
commit 0cd358676c
2 changed files with 29 additions and 9 deletions

View file

@ -308,5 +308,16 @@
"info_dict": { "info_dict": {
"title": "Vulkanausbruch in Ecuador: Der \"Feuerschlund\" ist wieder aktiv" "title": "Vulkanausbruch in Ecuador: Der \"Feuerschlund\" ist wieder aktiv"
} }
},
{
"name": "LiveLeak",
"md5": "0813c2430bea7a46bf13acf3406992f4",
"url": "http://www.liveleak.com/view?i=757_1364311680",
"file": "757_1364311680.mp4",
"info_dict": {
"title": "Most unlucky car accident",
"description": "extremely bad day for this guy..!",
"uploader": "ljfriel2"
}
} }
] ]

View file

@ -4160,9 +4160,9 @@ class SpiegelIE(InfoExtractor):
} }
return [info] return [info]
class liveleakIE(InfoExtractor): class LiveLeakIE(InfoExtractor):
_VALID_URL = r'^(?:http?://)?(?:\w+\.)?liveleak\.com/view\?(?:.*?)i=(?P<video_id>\d+)(?:.*)' _VALID_URL = r'^(?:http?://)?(?:\w+\.)?liveleak\.com/view\?(?:.*?)i=(?P<video_id>[\w_]+)(?:.*)'
IE_NAME = u'liveleak' IE_NAME = u'liveleak'
def _real_extract(self, url): def _real_extract(self, url):
@ -4171,17 +4171,20 @@ class liveleakIE(InfoExtractor):
self._downloader.trouble(u'ERROR: invalid URL: %s' % url) self._downloader.trouble(u'ERROR: invalid URL: %s' % url)
return return
video_id = mobj.group(1) video_id = mobj.group('video_id')
if video_id.endswith('/index.html'):
video_id = video_id[:-len('/index.html')]
webpage = self._download_webpage(url, video_id) 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'file: "(.*?)",', webpage)
if not m:
self._downloader.report_error(u'unable to find video url')
return
video_url = m.group(1)
m = re.search(r'<meta property="og:title" content="(?P<title>.*?)"', webpage) m = re.search(r'<meta property="og:title" content="(?P<title>.*?)"', webpage)
if not m: if not m:
self._downloader.trouble(u'Cannot find video title') self._downloader.trouble(u'Cannot find video title')
title = unescapeHTML(m.group('title')) title = unescapeHTML(m.group('title')).replace('LiveLeak.com -', '').strip()
m = re.search(r'<meta property="og:description" content="(?P<desc>.*?)"', webpage) m = re.search(r'<meta property="og:description" content="(?P<desc>.*?)"', webpage)
if m: if m:
@ -4189,13 +4192,19 @@ class liveleakIE(InfoExtractor):
else: else:
desc = None desc = None
m = re.search(r'By:.*?(\w+)</a>', webpage)
if m:
uploader = clean_html(m.group(1))
else:
uploader = None
info = { info = {
'id': video_id, 'id': video_id,
'url': video_url, 'url': video_url,
'ext': 'mp4', 'ext': 'mp4',
'title': title, 'title': title,
'description': desc 'description': desc,
'uploader': uploader
} }
return [info] return [info]
@ -4250,6 +4259,6 @@ def gen_extractors():
TEDIE(), TEDIE(),
MySpassIE(), MySpassIE(),
SpiegelIE(), SpiegelIE(),
liveleakIE(), LiveLeakIE(),
GenericIE() GenericIE()
] ]