logo

youtube-dl

[mirror] Download/Watch videos from video hostersgit clone https://hacktivis.me/git/mirror/youtube-dl.git

radiofrance.py (2089B)


  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. import re
  4. from .common import InfoExtractor
  5. class RadioFranceIE(InfoExtractor):
  6. _VALID_URL = r'^https?://maison\.radiofrance\.fr/radiovisions/(?P<id>[^?#]+)'
  7. IE_NAME = 'radiofrance'
  8. _TEST = {
  9. 'url': 'http://maison.radiofrance.fr/radiovisions/one-one',
  10. 'md5': 'bdbb28ace95ed0e04faab32ba3160daf',
  11. 'info_dict': {
  12. 'id': 'one-one',
  13. 'ext': 'ogg',
  14. 'title': 'One to one',
  15. 'description': "Plutôt que d'imaginer la radio de demain comme technologie ou comme création de contenu, je veux montrer que quelles que soient ses évolutions, j'ai l'intime conviction que la radio continuera d'être un grand média de proximité pour les auditeurs.",
  16. 'uploader': 'Thomas Hercouët',
  17. },
  18. }
  19. def _real_extract(self, url):
  20. m = re.match(self._VALID_URL, url)
  21. video_id = m.group('id')
  22. webpage = self._download_webpage(url, video_id)
  23. title = self._html_search_regex(r'<h1>(.*?)</h1>', webpage, 'title')
  24. description = self._html_search_regex(
  25. r'<div class="bloc_page_wrapper"><div class="text">(.*?)</div>',
  26. webpage, 'description', fatal=False)
  27. uploader = self._html_search_regex(
  28. r'<div class="credit">&nbsp;&nbsp;&copy;&nbsp;(.*?)</div>',
  29. webpage, 'uploader', fatal=False)
  30. formats_str = self._html_search_regex(
  31. r'class="jp-jplayer[^"]*" data-source="([^"]+)">',
  32. webpage, 'audio URLs')
  33. formats = [
  34. {
  35. 'format_id': fm[0],
  36. 'url': fm[1],
  37. 'vcodec': 'none',
  38. 'preference': i,
  39. }
  40. for i, fm in
  41. enumerate(re.findall(r"([a-z0-9]+)\s*:\s*'([^']+)'", formats_str))
  42. ]
  43. self._sort_formats(formats)
  44. return {
  45. 'id': video_id,
  46. 'title': title,
  47. 'formats': formats,
  48. 'description': description,
  49. 'uploader': uploader,
  50. }