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.

60 lines
2.3 KiB

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