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.

38 lines
1.1 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. import re
  4. from .common import InfoExtractor
  5. class FranceInterIE(InfoExtractor):
  6. _VALID_URL = r'http://(?:www\.)?franceinter\.fr/player/reecouter\?play=(?P<id>[0-9]{6})'
  7. _TEST = {
  8. 'url': 'http://www.franceinter.fr/player/reecouter?play=793962',
  9. 'file': '793962.mp3',
  10. 'md5': '4764932e466e6f6c79c317d2e74f6884',
  11. "info_dict": {
  12. "title": "L’Histoire dans les jeux vidéo",
  13. },
  14. }
  15. def _real_extract(self, url):
  16. mobj = re.match(self._VALID_URL, url)
  17. video_id = mobj.group('id')
  18. webpage = self._download_webpage(url, video_id)
  19. title = self._html_search_regex(
  20. r'<span class="roll_overflow">(.*?)</span></h1>', webpage, 'title')
  21. path = self._search_regex(
  22. r'&urlAOD=(.*?)&startTime', webpage, 'video url')
  23. video_url = 'http://www.franceinter.fr/' + path
  24. return {
  25. 'id': video_id,
  26. 'formats': [{
  27. 'url': video_url,
  28. 'vcodec': 'none',
  29. }],
  30. 'title': title,
  31. }