2014-04-03 06:55:38 +00:00
|
|
|
# coding: utf-8
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
from .common import InfoExtractor
|
2015-02-03 09:15:05 +00:00
|
|
|
from ..utils import (
|
|
|
|
determine_ext,
|
2016-08-13 14:00:34 +00:00
|
|
|
unified_strdate,
|
2015-02-03 09:15:05 +00:00
|
|
|
)
|
2014-04-03 06:55:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
class FranceCultureIE(InfoExtractor):
|
2016-08-13 14:00:34 +00:00
|
|
|
_VALID_URL = r'https?://(?:www\.)?franceculture\.fr/emissions/(?:[^/]+/)*(?P<id>[^/?#&]+)'
|
2014-04-03 06:55:38 +00:00
|
|
|
_TEST = {
|
2016-08-13 14:00:34 +00:00
|
|
|
'url': 'http://www.franceculture.fr/emissions/carnet-nomade/rendez-vous-au-pays-des-geeks',
|
2014-04-03 06:55:38 +00:00
|
|
|
'info_dict': {
|
2016-08-13 14:00:34 +00:00
|
|
|
'id': 'rendez-vous-au-pays-des-geeks',
|
|
|
|
'display_id': 'rendez-vous-au-pays-des-geeks',
|
2014-04-03 06:55:38 +00:00
|
|
|
'ext': 'mp3',
|
|
|
|
'title': 'Rendez-vous au pays des geeks',
|
2016-08-13 14:00:34 +00:00
|
|
|
'thumbnail': 're:^https?://.*\\.jpg$',
|
2014-04-03 06:55:38 +00:00
|
|
|
'upload_date': '20140301',
|
2016-08-13 14:00:34 +00:00
|
|
|
'vcodec': 'none',
|
2014-04-03 06:55:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-08-13 14:00:34 +00:00
|
|
|
def _real_extract(self, url):
|
|
|
|
display_id = self._match_id(url)
|
2015-02-03 09:15:05 +00:00
|
|
|
|
2016-08-13 14:00:34 +00:00
|
|
|
webpage = self._download_webpage(url, display_id)
|
2014-04-03 06:55:38 +00:00
|
|
|
|
2016-08-13 14:00:34 +00:00
|
|
|
video_url = self._search_regex(
|
2016-11-08 15:26:33 +00:00
|
|
|
r'(?s)<div[^>]+class="[^"]*?title-zone-diffusion[^"]*?"[^>]*>.*?<button[^>]+data-asset-source="([^"]+)"',
|
2016-08-13 14:00:34 +00:00
|
|
|
webpage, 'video path')
|
2015-12-27 14:30:45 +00:00
|
|
|
|
2016-08-13 14:00:34 +00:00
|
|
|
title = self._og_search_title(webpage)
|
2014-04-03 06:55:38 +00:00
|
|
|
|
2016-08-13 14:00:34 +00:00
|
|
|
upload_date = unified_strdate(self._search_regex(
|
|
|
|
'(?s)<div[^>]+class="date"[^>]*>.*?<span[^>]+class="inner"[^>]*>([^<]+)<',
|
|
|
|
webpage, 'upload date', fatal=False))
|
|
|
|
thumbnail = self._search_regex(
|
2016-11-08 15:26:33 +00:00
|
|
|
r'(?s)<figure[^>]+itemtype="https://schema.org/ImageObject"[^>]*>.*?<img[^>]+data-dejavu-src="([^"]+)"',
|
2016-08-13 14:00:34 +00:00
|
|
|
webpage, 'thumbnail', fatal=False)
|
2015-02-03 09:15:05 +00:00
|
|
|
uploader = self._html_search_regex(
|
|
|
|
r'(?s)<div id="emission".*?<span class="author">(.*?)</span>',
|
|
|
|
webpage, 'uploader', default=None)
|
|
|
|
vcodec = 'none' if determine_ext(video_url.lower()) == 'mp3' else None
|
2014-04-03 06:55:38 +00:00
|
|
|
|
|
|
|
return {
|
2016-08-13 14:00:34 +00:00
|
|
|
'id': display_id,
|
|
|
|
'display_id': display_id,
|
2014-04-03 06:55:38 +00:00
|
|
|
'url': video_url,
|
|
|
|
'title': title,
|
|
|
|
'thumbnail': thumbnail,
|
2016-08-13 14:00:34 +00:00
|
|
|
'vcodec': vcodec,
|
|
|
|
'uploader': uploader,
|
|
|
|
'upload_date': upload_date,
|
2014-04-03 06:55:38 +00:00
|
|
|
}
|