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