You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
2.3 KiB

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