]>
Commit | Line | Data |
---|---|---|
09334400 | 1 | import re |
09334400 | 2 | |
adf2c098 S |
3 | from .common import InfoExtractor |
4 | from ..utils import remove_start | |
09334400 | 5 | |
09334400 | 6 | |
adf2c098 S |
7 | class TeleMBIE(InfoExtractor): |
8 | _VALID_URL = r'https?://(?:www\.)?telemb\.be/(?P<display_id>.+?)_d_(?P<id>\d+)\.html' | |
9 | _TESTS = [ | |
10 | { | |
11 | 'url': 'http://www.telemb.be/mons-cook-with-danielle-des-cours-de-cuisine-en-anglais-_d_13466.html', | |
12 | 'md5': 'f45ea69878516ba039835794e0f8f783', | |
13 | 'info_dict': { | |
14 | 'id': '13466', | |
15 | 'display_id': 'mons-cook-with-danielle-des-cours-de-cuisine-en-anglais-', | |
16 | 'ext': 'mp4', | |
17 | 'title': 'Mons - Cook with Danielle : des cours de cuisine en anglais ! - Les reportages', | |
18 | 'description': 'md5:bc5225f47b17c309761c856ad4776265', | |
ec85ded8 | 19 | 'thumbnail': r're:^http://.*\.(?:jpg|png)$', |
adf2c098 S |
20 | } |
21 | }, | |
22 | { | |
f24e740b | 23 | # non-ASCII characters in download URL |
adf2c098 S |
24 | 'url': 'http://telemb.be/les-reportages-havre-incendie-mortel_d_13514.html', |
25 | 'md5': '6e9682736e5ccd4eab7f21e855350733', | |
26 | 'info_dict': { | |
27 | 'id': '13514', | |
28 | 'display_id': 'les-reportages-havre-incendie-mortel', | |
29 | 'ext': 'mp4', | |
30 | 'title': 'Havré - Incendie mortel - Les reportages', | |
31 | 'description': 'md5:5e54cb449acb029c2b7734e2d946bd4a', | |
ec85ded8 | 32 | 'thumbnail': r're:^http://.*\.(?:jpg|png)$', |
adf2c098 S |
33 | } |
34 | }, | |
35 | ] | |
09334400 L |
36 | |
37 | def _real_extract(self, url): | |
5ad28e7f | 38 | mobj = self._match_valid_url(url) |
09334400 | 39 | video_id = mobj.group('id') |
adf2c098 | 40 | display_id = mobj.group('display_id') |
09334400 | 41 | |
adf2c098 | 42 | webpage = self._download_webpage(url, display_id) |
09334400 | 43 | |
adf2c098 S |
44 | formats = [] |
45 | for video_url in re.findall(r'file\s*:\s*"([^"]+)"', webpage): | |
46 | fmt = { | |
47 | 'url': video_url, | |
48 | 'format_id': video_url.split(':')[0] | |
49 | } | |
50 | rtmp = re.search(r'^(?P<url>rtmp://[^/]+/(?P<app>.+))/(?P<playpath>mp4:.+)$', video_url) | |
51 | if rtmp: | |
52 | fmt.update({ | |
53 | 'play_path': rtmp.group('playpath'), | |
54 | 'app': rtmp.group('app'), | |
55 | 'player_url': 'http://p.jwpcdn.com/6/10/jwplayer.flash.swf', | |
56 | 'page_url': 'http://www.telemb.be', | |
f983b875 | 57 | 'preference': -10, |
adf2c098 S |
58 | }) |
59 | formats.append(fmt) | |
60 | self._sort_formats(formats) | |
09334400 | 61 | |
adf2c098 S |
62 | title = remove_start(self._og_search_title(webpage), 'TéléMB : ') |
63 | description = self._html_search_regex( | |
64 | r'<meta property="og:description" content="(.+?)" />', | |
65 | webpage, 'description', fatal=False) | |
66 | thumbnail = self._og_search_thumbnail(webpage) | |
09334400 | 67 | |
adf2c098 S |
68 | return { |
69 | 'id': video_id, | |
70 | 'display_id': display_id, | |
71 | 'title': title, | |
72 | 'description': description, | |
73 | 'thumbnail': thumbnail, | |
74 | 'formats': formats, | |
75 | } |