]> Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/telebruxelles.py
debian/control: Add B-D on pandoc and zip. Closes: #828905.
[youtubedl] / youtube_dl / extractor / telebruxelles.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 import re
5
6 from .common import InfoExtractor
7
8
9 class TeleBruxellesIE(InfoExtractor):
10 _VALID_URL = r'https?://(?:www\.)?(?:telebruxelles|bx1)\.be/(news|sport|dernier-jt)/?(?P<id>[^/#?]+)'
11 _TESTS = [{
12 'url': 'http://www.telebruxelles.be/news/auditions-devant-parlement-francken-galant-tres-attendus/',
13 'md5': '59439e568c9ee42fb77588b2096b214f',
14 'info_dict': {
15 'id': '11942',
16 'display_id': 'auditions-devant-parlement-francken-galant-tres-attendus',
17 'ext': 'flv',
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 },
24 }, {
25 'url': 'http://www.telebruxelles.be/sport/basket-brussels-bat-mons-80-74/',
26 'md5': '181d3fbdcf20b909309e5aef5c6c6047',
27 'info_dict': {
28 'id': '10091',
29 'display_id': 'basket-brussels-bat-mons-80-74',
30 'ext': 'flv',
31 'title': 'Basket : le Brussels bat Mons 80-74',
32 'description': 're:^Ils l\u2019on fait ! En basket, le B*',
33 },
34 'params': {
35 'skip_download': 'requires rtmpdump'
36 },
37 }]
38
39 def _real_extract(self, url):
40 display_id = self._match_id(url)
41 webpage = self._download_webpage(url, display_id)
42
43 article_id = self._html_search_regex(
44 r"<article id=\"post-(\d+)\"", webpage, 'article ID', default=None)
45 title = self._html_search_regex(
46 r'<h1 class=\"entry-title\">(.*?)</h1>', webpage, 'title')
47 description = self._og_search_description(webpage, default=None)
48
49 rtmp_url = self._html_search_regex(
50 r'file\s*:\s*"(rtmp://[^/]+/vod/mp4:"\s*\+\s*"[^"]+"\s*\+\s*".mp4)"',
51 webpage, 'RTMP url')
52 rtmp_url = re.sub(r'"\s*\+\s*"', '', rtmp_url)
53
54 return {
55 'id': article_id or display_id,
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 }