aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/utils.py
diff options
context:
space:
mode:
authorrenalid <renaud.euvrard@MAC-1636.local>2016-09-02 18:31:52 +0200
committerSergey M․ <dstftw@gmail.com>2016-09-14 23:59:38 +0700
commita942d6cb48994c5ff14ccef8773fb086a5544970 (patch)
tree44a6641240889e5ded6ca7c7a7e2ddaa93ca071b /youtube_dl/utils.py
parent961516bfd1f3b514859f03766d282824ba8a76f5 (diff)
downloadyoutube-dl-a942d6cb48994c5ff14ccef8773fb086a5544970.tar.xz
[utils,franceinter] Add french months' names and fix extraction
Update of the "FranceInter" radio extractor : webpages HTML structure had changed, the extractor didn't work. So I updated this extractor to get the mp3 URL and all details.
Diffstat (limited to 'youtube_dl/utils.py')
-rw-r--r--youtube_dl/utils.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index ed199c4ad..623ced625 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -91,6 +91,10 @@ ENGLISH_MONTH_NAMES = [
'January', 'February', 'March', 'April', 'May', 'June',
'July', 'August', 'September', 'October', 'November', 'December']
+FRENCH_MONTH_NAMES = [
+ 'janvier', 'fevrier', 'mars', 'avril', 'mai', 'juin',
+ 'juillet', 'aout', 'septembre', 'octobre', 'novembre', 'decembre']
+
KNOWN_EXTENSIONS = (
'mp4', 'm4a', 'm4p', 'm4b', 'm4r', 'm4v', 'aac',
'flv', 'f4v', 'f4a', 'f4b',
@@ -1587,11 +1591,16 @@ def parse_count(s):
return lookup_unit_table(_UNIT_TABLE, s)
-def month_by_name(name):
+def month_by_name(name, lang='en'):
""" Return the number of a month by (locale-independently) English name """
+ name_list = ENGLISH_MONTH_NAMES
+
+ if lang == 'fr':
+ name_list = FRENCH_MONTH_NAMES
+
try:
- return ENGLISH_MONTH_NAMES.index(name) + 1
+ return name_list.index(name) + 1
except ValueError:
return None