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