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.

49 lines
1.6 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. from ..utils import int_or_none
  5. class FranceInterIE(InfoExtractor):
  6. _VALID_URL = r'http://(?:www\.)?franceinter\.fr/player/reecouter\?play=(?P<id>[0-9]+)'
  7. _TEST = {
  8. 'url': 'http://www.franceinter.fr/player/reecouter?play=793962',
  9. 'md5': '4764932e466e6f6c79c317d2e74f6884',
  10. "info_dict": {
  11. 'id': '793962',
  12. 'ext': 'mp3',
  13. 'title': 'L’Histoire dans les jeux vidéo',
  14. 'description': 'md5:7e93ddb4451e7530022792240a3049c7',
  15. 'timestamp': 1387369800,
  16. 'upload_date': '20131218',
  17. },
  18. }
  19. def _real_extract(self, url):
  20. video_id = self._match_id(url)
  21. webpage = self._download_webpage(url, video_id)
  22. path = self._search_regex(
  23. r'<a id="player".+?href="([^"]+)"', webpage, 'video url')
  24. video_url = 'http://www.franceinter.fr/' + path
  25. title = self._html_search_regex(
  26. r'<span class="title-diffusion">(.+?)</span>', webpage, 'title')
  27. description = self._html_search_regex(
  28. r'<span class="description">(.*?)</span>',
  29. webpage, 'description', fatal=False)
  30. timestamp = int_or_none(self._search_regex(
  31. r'data-date="(\d+)"', webpage, 'upload date', fatal=False))
  32. return {
  33. 'id': video_id,
  34. 'title': title,
  35. 'description': description,
  36. 'timestamp': timestamp,
  37. 'formats': [{
  38. 'url': video_url,
  39. 'vcodec': 'none',
  40. }],
  41. }