From 6bb5f07c538581009036e9973a5cec5f8af18884 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Cie=C5=9Blak?= Date: Wed, 14 Jun 2017 23:27:50 +0200 Subject: [PATCH] [disney] provide episode_number and season_number for some series --- youtube_dl/extractor/disney.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/youtube_dl/extractor/disney.py b/youtube_dl/extractor/disney.py index 968c4c7fd..3bd262a36 100644 --- a/youtube_dl/extractor/disney.py +++ b/youtube_dl/extractor/disney.py @@ -150,7 +150,7 @@ class DisneyIE(InfoExtractor): }.get(caption_format, caption_format), }) - return { + metadata = { 'id': video_id, 'title': title, 'description': video_data.get('description') or video_data.get('short_desc'), @@ -160,3 +160,16 @@ class DisneyIE(InfoExtractor): 'formats': formats, 'subtitles': subtitles, } + + externals = video_data.get('externals', {}) + if len(externals) > 0: + data_pack = externals[0].get('data', {}) + if data_pack: + season_number = int_or_none(data_pack.get('Season', None)) + episode_number = int_or_none(data_pack.get('Episode', None)) + if season_number: + metadata['season_number'] = season_number + if episode_number: + metadata['episode_number'] = episode_number + + return metadata