2014-01-15 06:19:50 +00:00
|
|
|
from .common import InfoExtractor
|
2016-09-14 16:59:13 +00:00
|
|
|
from ..utils import month_by_name
|
2014-01-17 02:09:07 +00:00
|
|
|
|
|
|
|
|
2014-01-15 06:19:50 +00:00
|
|
|
class FranceInterIE(InfoExtractor):
|
2016-09-02 16:31:52 +00:00
|
|
|
_VALID_URL = r'https?://(?:www\.)?franceinter\.fr/emissions/(?P<id>[^?#]+)'
|
|
|
|
|
2014-01-17 02:09:07 +00:00
|
|
|
_TEST = {
|
2016-09-17 08:44:37 +00:00
|
|
|
'url': 'https://www.franceinter.fr/emissions/affaires-sensibles/affaires-sensibles-07-septembre-2016',
|
|
|
|
'md5': '9e54d7bdb6fdc02a841007f8a975c094',
|
2016-02-14 09:37:17 +00:00
|
|
|
'info_dict': {
|
2016-09-17 08:44:37 +00:00
|
|
|
'id': 'affaires-sensibles/affaires-sensibles-07-septembre-2016',
|
2014-09-19 13:58:50 +00:00
|
|
|
'ext': 'mp3',
|
2016-09-17 08:44:37 +00:00
|
|
|
'title': 'Affaire Cahuzac : le contentieux du compte en Suisse',
|
|
|
|
'description': 'md5:401969c5d318c061f86bda1fa359292b',
|
2020-11-23 21:03:08 +00:00
|
|
|
'thumbnail': r're:^https?://.*\.jpg',
|
2016-09-17 08:44:37 +00:00
|
|
|
'upload_date': '20160907',
|
2014-01-17 02:09:07 +00:00
|
|
|
},
|
|
|
|
}
|
2014-01-15 06:19:50 +00:00
|
|
|
|
2014-01-17 02:09:07 +00:00
|
|
|
def _real_extract(self, url):
|
2015-12-22 10:30:35 +00:00
|
|
|
video_id = self._match_id(url)
|
2014-01-17 02:10:54 +00:00
|
|
|
|
2014-01-17 02:09:07 +00:00
|
|
|
webpage = self._download_webpage(url, video_id)
|
2014-09-19 13:58:50 +00:00
|
|
|
|
2016-09-02 16:31:52 +00:00
|
|
|
video_url = self._search_regex(
|
2016-09-14 16:59:13 +00:00
|
|
|
r'(?s)<div[^>]+class=["\']page-diffusion["\'][^>]*>.*?<button[^>]+data-url=(["\'])(?P<url>(?:(?!\1).)+)\1',
|
|
|
|
webpage, 'video url', group='url')
|
2016-09-02 16:31:52 +00:00
|
|
|
|
|
|
|
title = self._og_search_title(webpage)
|
|
|
|
description = self._og_search_description(webpage)
|
2020-11-23 21:03:08 +00:00
|
|
|
thumbnail = self._html_search_meta(['og:image', 'twitter:image'], webpage)
|
2016-09-02 16:31:52 +00:00
|
|
|
|
2016-09-14 16:59:13 +00:00
|
|
|
upload_date_str = self._search_regex(
|
2018-01-21 10:50:53 +00:00
|
|
|
r'class=["\']\s*cover-emission-period\s*["\'][^>]*>[^<]+\s+(\d{1,2}\s+[^\s]+\s+\d{4})<',
|
2016-09-14 16:59:13 +00:00
|
|
|
webpage, 'upload date', fatal=False)
|
|
|
|
if upload_date_str:
|
|
|
|
upload_date_list = upload_date_str.split()
|
|
|
|
upload_date_list.reverse()
|
2024-11-22 22:11:00 +00:00
|
|
|
upload_date_list[1] = f'{(month_by_name(upload_date_list[1], lang="fr") or 0):02d}'
|
|
|
|
upload_date_list[2] = f'{int(upload_date_list[2]):02d}'
|
2016-09-14 16:59:13 +00:00
|
|
|
upload_date = ''.join(upload_date_list)
|
|
|
|
else:
|
|
|
|
upload_date = None
|
2014-09-19 13:58:50 +00:00
|
|
|
|
2014-01-17 02:09:07 +00:00
|
|
|
return {
|
|
|
|
'id': video_id,
|
2014-09-19 13:58:50 +00:00
|
|
|
'title': title,
|
|
|
|
'description': description,
|
2020-11-23 21:03:08 +00:00
|
|
|
'thumbnail': thumbnail,
|
2016-09-14 16:59:13 +00:00
|
|
|
'upload_date': upload_date,
|
2014-01-17 02:09:07 +00:00
|
|
|
'formats': [{
|
|
|
|
'url': video_url,
|
|
|
|
'vcodec': 'none',
|
|
|
|
}],
|
|
|
|
}
|