2014-01-17 10:09:07 +08:00
|
|
|
|
# coding: utf-8
|
2014-01-15 19:18:55 +08:00
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
2014-01-15 14:19:50 +08:00
|
|
|
|
from .common import InfoExtractor
|
2016-09-15 00:59:13 +08:00
|
|
|
|
from ..compat import compat_str
|
|
|
|
|
from ..utils import month_by_name
|
2014-01-17 10:09:07 +08:00
|
|
|
|
|
|
|
|
|
|
2014-01-15 14:19:50 +08:00
|
|
|
|
class FranceInterIE(InfoExtractor):
|
2016-09-03 00:31:52 +08:00
|
|
|
|
_VALID_URL = r'https?://(?:www\.)?franceinter\.fr/emissions/(?P<id>[^?#]+)'
|
|
|
|
|
|
2014-01-17 10:09:07 +08:00
|
|
|
|
_TEST = {
|
2016-09-03 00:31:52 +08:00
|
|
|
|
'url': 'https://www.franceinter.fr/emissions/la-marche-de-l-histoire/la-marche-de-l-histoire-18-decembre-2013',
|
2014-01-17 10:09:07 +08:00
|
|
|
|
'md5': '4764932e466e6f6c79c317d2e74f6884',
|
2016-02-14 17:37:17 +08:00
|
|
|
|
'info_dict': {
|
2016-09-03 00:31:52 +08:00
|
|
|
|
'id': 'la-marche-de-l-histoire/la-marche-de-l-histoire-18-decembre-2013',
|
2014-09-19 21:58:50 +08:00
|
|
|
|
'ext': 'mp3',
|
2016-09-03 00:31:52 +08:00
|
|
|
|
'title': 'L’Histoire dans les jeux vidéo du 18 décembre 2013 - France Inter',
|
2016-09-15 00:59:13 +08:00
|
|
|
|
'description': 'md5:7f2ce449894d1e585932273080fb410d',
|
2014-09-19 21:58:50 +08:00
|
|
|
|
'upload_date': '20131218',
|
2014-01-17 10:09:07 +08:00
|
|
|
|
},
|
|
|
|
|
}
|
2014-01-15 14:19:50 +08:00
|
|
|
|
|
2014-01-17 10:09:07 +08:00
|
|
|
|
def _real_extract(self, url):
|
2015-12-22 18:30:35 +08:00
|
|
|
|
video_id = self._match_id(url)
|
2014-01-17 10:10:54 +08:00
|
|
|
|
|
2014-01-17 10:09:07 +08:00
|
|
|
|
webpage = self._download_webpage(url, video_id)
|
2014-09-19 21:58:50 +08:00
|
|
|
|
|
2016-09-03 00:31:52 +08:00
|
|
|
|
video_url = self._search_regex(
|
2016-09-15 00:59:13 +08:00
|
|
|
|
r'(?s)<div[^>]+class=["\']page-diffusion["\'][^>]*>.*?<button[^>]+data-url=(["\'])(?P<url>(?:(?!\1).)+)\1',
|
|
|
|
|
webpage, 'video url', group='url')
|
2016-09-03 00:31:52 +08:00
|
|
|
|
|
|
|
|
|
title = self._og_search_title(webpage)
|
|
|
|
|
description = self._og_search_description(webpage)
|
|
|
|
|
|
2016-09-15 00:59:13 +08:00
|
|
|
|
upload_date_str = self._search_regex(
|
|
|
|
|
r'class=["\']cover-emission-period["\'][^>]*>[^<]+\s+(\d{1,2}\s+[^\s]+\s+\d{4})<',
|
|
|
|
|
webpage, 'upload date', fatal=False)
|
|
|
|
|
if upload_date_str:
|
|
|
|
|
upload_date_list = upload_date_str.split()
|
|
|
|
|
upload_date_list.reverse()
|
|
|
|
|
upload_date_list[1] = compat_str(month_by_name(upload_date_list[1], lang='fr'))
|
|
|
|
|
upload_date = ''.join(upload_date_list)
|
|
|
|
|
else:
|
|
|
|
|
upload_date = None
|
2014-09-19 21:58:50 +08:00
|
|
|
|
|
2014-01-17 10:09:07 +08:00
|
|
|
|
return {
|
|
|
|
|
'id': video_id,
|
2014-09-19 21:58:50 +08:00
|
|
|
|
'title': title,
|
|
|
|
|
'description': description,
|
2016-09-15 00:59:13 +08:00
|
|
|
|
'upload_date': upload_date,
|
2014-01-17 10:09:07 +08:00
|
|
|
|
'formats': [{
|
|
|
|
|
'url': video_url,
|
|
|
|
|
'vcodec': 'none',
|
|
|
|
|
}],
|
|
|
|
|
}
|