[FranceInter] Extractor Update (corrections)
- correct the test with the same original content (the URL and HTML had change) - correct how to get the right date of the content using adaptation of french month name
This commit is contained in:
parent
be61d19833
commit
b0c9070d68
@ -6,6 +6,7 @@ from ..utils import (
|
|||||||
int_or_none,
|
int_or_none,
|
||||||
unified_strdate,
|
unified_strdate,
|
||||||
unified_timestamp,
|
unified_timestamp,
|
||||||
|
month_by_french_name,
|
||||||
)
|
)
|
||||||
|
|
||||||
import re
|
import re
|
||||||
@ -14,15 +15,15 @@ class FranceInterIE(InfoExtractor):
|
|||||||
_VALID_URL = r'https?://(?:www\.)?franceinter\.fr/emissions/(?P<id>[^?#]+)'
|
_VALID_URL = r'https?://(?:www\.)?franceinter\.fr/emissions/(?P<id>[^?#]+)'
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
'url': 'https://www.franceinter.fr/emissions/la-tete-au-carre/la-tete-au-carre-30-juin-2016',
|
'url': 'https://www.franceinter.fr/emissions/la-marche-de-l-histoire/la-marche-de-l-histoire-18-decembre-2013',
|
||||||
'md5': 'f13e4371662cf5a829f64d829ae78062',
|
'md5': '4764932e466e6f6c79c317d2e74f6884',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'la-tete-au-carre/la-tete-au-carre-30-juin-2016',
|
'id': 'la-marche-de-l-histoire/la-marche-de-l-histoire-18-decembre-2013',
|
||||||
'ext': 'mp3',
|
'ext': 'mp3',
|
||||||
'title': 'Regards sur le sport du 30 juin 2016 - France Inter',
|
'title': 'L’Histoire dans les jeux vidéo du 18 décembre 2013 - France Inter',
|
||||||
'description': 'UEFA Europa, Jeux Olympiques... La période est aux sports, dans les gradins ou devant les écrans. Mais quel est le regard des spécialistes sur cette pratique? ',
|
'description': 'L’Histoire dans les jeux vidéo du 18 décembre 2013 par Jean Lebrun en replay sur France Inter. Retrouvez l\'émission en réécoute gratuite et abonnez-vous au podcast !',
|
||||||
'timestamp': 1467244800,
|
'timestamp': 1387324800,
|
||||||
'upload_date': '20160630',
|
'upload_date': '20131218',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,12 +38,16 @@ class FranceInterIE(InfoExtractor):
|
|||||||
title = self._og_search_title(webpage)
|
title = self._og_search_title(webpage)
|
||||||
description = self._og_search_description(webpage)
|
description = self._og_search_description(webpage)
|
||||||
|
|
||||||
extractdate = self._search_regex(
|
extractdate = self._html_search_regex(
|
||||||
r'([0-9]+[.][0-9]+[.][0-9]+)', video_url, 'extractdate', fatal=False)
|
r'<span class="header-main-content-date">(.*?)</span>', webpage, 'extractdate', fatal=False)
|
||||||
|
|
||||||
|
extractdate = extractdate.split()
|
||||||
|
|
||||||
|
extractdate = extractdate[3]+","+str(month_by_french_name(extractdate[2]))+","+extractdate[1]
|
||||||
|
|
||||||
|
upload_date = unified_strdate(extractdate)
|
||||||
|
|
||||||
timestamp = unified_timestamp(extractdate)
|
timestamp = unified_timestamp(extractdate)
|
||||||
|
|
||||||
upload_date = (unified_strdate(extractdate))
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
|
@ -89,6 +89,10 @@ NO_DEFAULT = object()
|
|||||||
ENGLISH_MONTH_NAMES = [
|
ENGLISH_MONTH_NAMES = [
|
||||||
'January', 'February', 'March', 'April', 'May', 'June',
|
'January', 'February', 'March', 'April', 'May', 'June',
|
||||||
'July', 'August', 'September', 'October', 'November', 'December']
|
'July', 'August', 'September', 'October', 'November', 'December']
|
||||||
|
|
||||||
|
FRENCH_MONTH_NAMES = [
|
||||||
|
'janvier', 'février', 'mars', 'avril', 'mai', 'juin',
|
||||||
|
'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre']
|
||||||
|
|
||||||
KNOWN_EXTENSIONS = (
|
KNOWN_EXTENSIONS = (
|
||||||
'mp4', 'm4a', 'm4p', 'm4b', 'm4r', 'm4v', 'aac',
|
'mp4', 'm4a', 'm4p', 'm4b', 'm4r', 'm4v', 'aac',
|
||||||
@ -1558,6 +1562,13 @@ def month_by_name(name):
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def month_by_french_name(name):
|
||||||
|
""" Return the number of a month by French name """
|
||||||
|
|
||||||
|
try:
|
||||||
|
return FRENCH_MONTH_NAMES.index(name) + 1
|
||||||
|
except ValueError:
|
||||||
|
return None
|
||||||
|
|
||||||
def month_by_abbreviation(abbrev):
|
def month_by_abbreviation(abbrev):
|
||||||
""" Return the number of a month by (locale-independently) English
|
""" Return the number of a month by (locale-independently) English
|
||||||
|
Loading…
x
Reference in New Issue
Block a user