]>
Commit | Line | Data |
---|---|---|
2cead7e7 | 1 | # coding: utf-8 |
2 | from __future__ import unicode_literals | |
3 | ||
4 | import re | |
5 | import json | |
6 | ||
7 | from .common import InfoExtractor | |
8 | ||
9 | ||
10 | class TeleBruxellesIE(InfoExtractor): | |
11 | _VALID_URL = r'https?://(?:www\.)?telebruxelles\.be/(news|sport|dernier-jt)/?(?P<title>[^\?]+)' | |
12 | _TESTS = [{ | |
13 | 'url': r'http://www.telebruxelles.be/news/auditions-devant-parlement-francken-galant-tres-attendus/', | |
14 | 'md5': '59439e568c9ee42fb77588b2096b214f', | |
15 | 'info_dict': { | |
16 | 'id': '11942', | |
17 | 'ext': 'flv', | |
18 | 'title': 're:Parlement : Francken et Galant répondent aux interpellations*', | |
19 | 'description': 're:Les auditions des ministres se poursuivent*' | |
20 | } | |
21 | }, { | |
22 | 'url': r'http://www.telebruxelles.be/sport/basket-brussels-bat-mons-80-74/', | |
23 | 'md5': '181d3fbdcf20b909309e5aef5c6c6047', | |
24 | 'info_dict': { | |
25 | 'id': '10091', | |
26 | 'ext': 'flv', | |
27 | 'title': 'Basket : le Brussels bat Mons 80-74', | |
28 | 'description': 're:Ils l\u2019on fait ! En basket, le B*' | |
29 | } | |
30 | }] | |
31 | ||
32 | def _real_extract(self, url): | |
33 | mobj = re.match(self._VALID_URL, url) | |
34 | title = mobj.group('title') | |
35 | ||
36 | webpage = self._download_webpage(url, title) | |
37 | ||
38 | article_id = self._html_search_regex(r"<article id=\"post-(\d+)\"", webpage, '0') | |
39 | title = self._html_search_regex(r'<h1 class=\"entry-title\">(.*?)</h1>', webpage, 'title') | |
40 | description = self._html_search_regex(r"property=\"og:description\" content=\"(.*?)\"", webpage, 'description', fatal=False) | |
41 | ||
42 | rtmp_url = self._html_search_regex(r"file: \"(rtmp://\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}:\d{1,5}/vod/mp4:\" \+ \"\w+\" \+ \".mp4)\"", webpage, 'url') | |
43 | rtmp_url = rtmp_url.replace("\" + \"", "") | |
44 | ||
45 | return { | |
46 | 'id': article_id, | |
47 | 'title': title, | |
48 | 'description': description, | |
49 | 'url': rtmp_url, | |
50 | 'ext': 'flv', | |
51 | 'rtmp_live': True # if rtmpdump is not called with "--live" argument, the download is blocked and can be completed | |
52 | } |