]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/liveleak.py
debian/control: Fix syntax error in Depends: field.
[youtubedl] / youtube_dl / extractor / liveleak.py
1 import re
2
3 from .common import InfoExtractor
4 from ..utils import (
5 ExtractorError,
6 )
7
8
9 class LiveLeakIE(InfoExtractor):
10
11 _VALID_URL = r'^(?:http?://)?(?:\w+\.)?liveleak\.com/view\?(?:.*?)i=(?P<video_id>[\w_]+)(?:.*)'
12 IE_NAME = u'liveleak'
13
14 def _real_extract(self, url):
15 mobj = re.match(self._VALID_URL, url)
16 if mobj is None:
17 raise ExtractorError(u'Invalid URL: %s' % url)
18
19 video_id = mobj.group('video_id')
20
21 webpage = self._download_webpage(url, video_id)
22
23 video_url = self._search_regex(r'file: "(.*?)",',
24 webpage, u'video URL')
25
26 video_title = self._html_search_regex(r'<meta property="og:title" content="(?P<title>.*?)"',
27 webpage, u'title').replace('LiveLeak.com -', '').strip()
28
29 video_description = self._html_search_regex(r'<meta property="og:description" content="(?P<desc>.*?)"',
30 webpage, u'description', fatal=False)
31
32 video_uploader = self._html_search_regex(r'By:.*?(\w+)</a>',
33 webpage, u'uploader', fatal=False)
34
35 info = {
36 'id': video_id,
37 'url': video_url,
38 'ext': 'mp4',
39 'title': video_title,
40 'description': video_description,
41 'uploader': video_uploader
42 }
43
44 return [info]