aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/InfoExtractors.py
diff options
context:
space:
mode:
authorFilippo Valsorda <filippo.valsorda@gmail.com>2013-03-29 15:13:24 +0100
committerFilippo Valsorda <filippo.valsorda@gmail.com>2013-03-29 15:13:24 +0100
commit0cd358676c06cc5915b3fb98388645833da4d7e0 (patch)
tree06fdec45e7df906e45f42ff41cdf980029e0a9d8 /youtube_dl/InfoExtractors.py
parent43113d92cc89cb6c9ff98a1b45512a92c71abb23 (diff)
Rebased, fixed and extended LiveLeak.com support
close #757 - close #761
Diffstat (limited to 'youtube_dl/InfoExtractors.py')
-rwxr-xr-xyoutube_dl/InfoExtractors.py27
1 files changed, 18 insertions, 9 deletions
diff --git a/youtube_dl/InfoExtractors.py b/youtube_dl/InfoExtractors.py
index eb1f32480..45a23989a 100755
--- a/youtube_dl/InfoExtractors.py
+++ b/youtube_dl/InfoExtractors.py
@@ -4160,9 +4160,9 @@ class SpiegelIE(InfoExtractor):
}
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'
def _real_extract(self, url):
@@ -4171,17 +4171,20 @@ class liveleakIE(InfoExtractor):
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')]
+ video_id = mobj.group('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)
if not m:
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)
if m:
@@ -4189,13 +4192,19 @@ class liveleakIE(InfoExtractor):
else:
desc = None
+ m = re.search(r'By:.*?(\w+)</a>', webpage)
+ if m:
+ uploader = clean_html(m.group(1))
+ else:
+ uploader = None
info = {
'id': video_id,
'url': video_url,
'ext': 'mp4',
'title': title,
- 'description': desc
+ 'description': desc,
+ 'uploader': uploader
}
return [info]
@@ -4250,6 +4259,6 @@ def gen_extractors():
TEDIE(),
MySpassIE(),
SpiegelIE(),
- liveleakIE(),
+ LiveLeakIE(),
GenericIE()
]