From 7109903e6140e01b5d5980fc80c6ef1b6c86797a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergey=20M=E2=80=A4?= Date: Thu, 31 Dec 2015 03:10:44 +0600 Subject: [PATCH 1/6] [extractor/common] Document chapter and series fields --- youtube_dl/extractor/common.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py index 655207447..c443daf20 100644 --- a/youtube_dl/extractor/common.py +++ b/youtube_dl/extractor/common.py @@ -200,6 +200,26 @@ class InfoExtractor(object): end_time: Time in seconds where the reproduction should end, as specified in the URL. + The following fields should only be used when the video belongs to some logical + chapter or section: + + chapter: Name or title of the chapter the video belongs to. + chapter_id: Number or id of the chapter the video belongs to, as an integer + or unicode string. + + The following fields should only be used when the video is an episode of some + series or programme: + + series: Title of the series or programme the video episode belongs to. + season: Title of the season the video episode belongs to. + season_id: Number or id of the season the video episode belongs to, as an + integer or unicode string. + episode: Title of the video episode. Unlike mandatory video title field, + this field should denote the exact title of the video episode + without any kind of decoration. + episode_id: Number or id of the video episode within a season, as an integer + or unicode string. + Unless mentioned otherwise, the fields should be Unicode strings. Unless mentioned otherwise, None is equivalent to absence of information. From 4d402db52140458b1b4707c30fb01bb92861a8cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergey=20M=E2=80=A4?= Date: Thu, 31 Dec 2015 03:11:21 +0600 Subject: [PATCH 2/6] [udemy] Extract chapter info --- youtube_dl/extractor/udemy.py | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/youtube_dl/extractor/udemy.py b/youtube_dl/extractor/udemy.py index ce7e211fc..41097829d 100644 --- a/youtube_dl/extractor/udemy.py +++ b/youtube_dl/extractor/udemy.py @@ -244,10 +244,25 @@ class UdemyCourseIE(UdemyIE): 'https://www.udemy.com/api-1.1/courses/%s/curriculum' % course_id, course_id, 'Downloading course curriculum') - entries = [ - self.url_result( - 'https://www.udemy.com/%s/#/lecture/%s' % (course_path, asset['id']), 'Udemy') - for asset in response if asset.get('assetType') or asset.get('asset_type') == 'Video' - ] + entries = [] + chapter, chapter_id = None, None + for asset in response: + asset_type = asset.get('assetType') or asset.get('asset_type') + if asset_type == 'Video': + asset_id = asset.get('id') + if asset_id: + entry = { + '_type': 'url_transparent', + 'url': 'https://www.udemy.com/%s/#/lecture/%s' % (course_path, asset['id']), + 'ie_key': UdemyIE.ie_key(), + } + if chapter_id: + entry['chapter_id'] = chapter_id + if chapter: + entry['chapter'] = chapter + entries.append(entry) + elif asset.get('type') == 'chapter': + chapter_id = asset.get('index') or asset.get('object_index') + chapter = asset.get('title') return self.playlist_result(entries, course_id, course_title) From 7a0b07c719b621b1572120ed3f04870fa5737bfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergey=20M=E2=80=A4?= Date: Thu, 31 Dec 2015 03:13:02 +0600 Subject: [PATCH 3/6] [videomore] Extract series info --- youtube_dl/extractor/videomore.py | 56 +++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/youtube_dl/extractor/videomore.py b/youtube_dl/extractor/videomore.py index 16078ac19..3bd96e445 100644 --- a/youtube_dl/extractor/videomore.py +++ b/youtube_dl/extractor/videomore.py @@ -23,11 +23,56 @@ class VideomoreIE(InfoExtractor): 'ext': 'flv', 'title': 'В гостях Алексей Чумаков и Юлия Ковальчук', 'description': 'В гостях – лучшие романтические комедии года, «Выживший» Иньярриту и «Стив Джобс» Дэнни Бойла.', + 'series': 'Кино в деталях', + 'episode': 'В гостях Алексей Чумаков и Юлия Ковальчук', + 'episode_id': None, + 'season': 'Сезон 2015', + 'season_id': 5, 'thumbnail': 're:^https?://.*\.jpg', 'duration': 2910, 'age_limit': 16, 'view_count': int, }, + }, { + 'url': 'http://videomore.ru/embed/259974', + 'info_dict': { + 'id': '259974', + 'ext': 'flv', + 'title': '80 серия', + 'description': '«Медведей» ждет решающий матч. Макеев выясняет отношения со Стрельцовым. Парни узнают подробности прошлого Макеева.', + 'series': 'Молодежка', + 'episode': '80 серия', + 'episode_id': 40, + 'season': '2 сезон', + 'season_id': 2, + 'thumbnail': 're:^https?://.*\.jpg', + 'duration': 2809, + 'age_limit': 16, + 'view_count': int, + }, + 'params': { + 'skip_download': True, + }, + }, { + 'url': 'http://videomore.ru/molodezhka/sezon_promo/341073', + 'info_dict': { + 'id': '341073', + 'ext': 'flv', + 'title': 'Команда проиграла из-за Бакина?', + 'description': 'Молодежка 3 сезон скоро', + 'series': 'Молодежка', + 'episode': 'Команда проиграла из-за Бакина?', + 'episode_id': None, + 'season': 'Промо', + 'season_id': 99, + 'thumbnail': 're:^https?://.*\.jpg', + 'duration': 29, + 'age_limit': 16, + 'view_count': int, + }, + 'params': { + 'skip_download': True, + }, }, { 'url': 'http://videomore.ru/elki_3?track_id=364623', 'only_matching': True, @@ -81,10 +126,21 @@ class VideomoreIE(InfoExtractor): 'url': thumbnail, } for thumbnail in data.get('big_thumbnail_urls', [])] + series = data.get('project_title') + episode = data.get('title') + episode_id = data.get('episode_of_season') or None + season = data.get('season_title') + season_id = data.get('season_pos') or None + return { 'id': video_id, 'title': title, 'description': description, + 'series': series, + 'episode': episode, + 'episode_id': episode_id, + 'season': season, + 'season_id': season_id, 'thumbnails': thumbnails, 'timestamp': timestamp, 'duration': duration, From 27bfd4e5266623d9000ba17e6bb2a72eefb0e22d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergey=20M=E2=80=A4?= Date: Fri, 1 Jan 2016 20:26:56 +0600 Subject: [PATCH 4/6] [extractor/common] Introduce number fields for chapters and series --- youtube_dl/extractor/common.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py index c443daf20..c63157619 100644 --- a/youtube_dl/extractor/common.py +++ b/youtube_dl/extractor/common.py @@ -204,21 +204,21 @@ class InfoExtractor(object): chapter or section: chapter: Name or title of the chapter the video belongs to. - chapter_id: Number or id of the chapter the video belongs to, as an integer - or unicode string. + chapter_number: Number of the chapter the video belongs to, as an integer. + chapter_id: Id of the chapter the video belongs to, as a unicode string. The following fields should only be used when the video is an episode of some series or programme: series: Title of the series or programme the video episode belongs to. season: Title of the season the video episode belongs to. - season_id: Number or id of the season the video episode belongs to, as an - integer or unicode string. + season_number: Number of the season the video episode belongs to, as an integer. + season_id: Id of the season the video episode belongs to, as a unicode string. episode: Title of the video episode. Unlike mandatory video title field, this field should denote the exact title of the video episode without any kind of decoration. - episode_id: Number or id of the video episode within a season, as an integer - or unicode string. + episode_number: Number of the video episode within a season, as an integer. + episode_id: Id of the video episode, as a unicode string. Unless mentioned otherwise, the fields should be Unicode strings. From 306c51c66922abb1846640b81c9b7c4d6a570d37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergey=20M=E2=80=A4?= Date: Fri, 1 Jan 2016 20:30:08 +0600 Subject: [PATCH 5/6] [videomore] Use number fields for series --- youtube_dl/extractor/videomore.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/youtube_dl/extractor/videomore.py b/youtube_dl/extractor/videomore.py index 3bd96e445..a66d6de23 100644 --- a/youtube_dl/extractor/videomore.py +++ b/youtube_dl/extractor/videomore.py @@ -25,9 +25,9 @@ class VideomoreIE(InfoExtractor): 'description': 'В гостях – лучшие романтические комедии года, «Выживший» Иньярриту и «Стив Джобс» Дэнни Бойла.', 'series': 'Кино в деталях', 'episode': 'В гостях Алексей Чумаков и Юлия Ковальчук', - 'episode_id': None, + 'episode_number': None, 'season': 'Сезон 2015', - 'season_id': 5, + 'season_number': 5, 'thumbnail': 're:^https?://.*\.jpg', 'duration': 2910, 'age_limit': 16, @@ -42,9 +42,9 @@ class VideomoreIE(InfoExtractor): 'description': '«Медведей» ждет решающий матч. Макеев выясняет отношения со Стрельцовым. Парни узнают подробности прошлого Макеева.', 'series': 'Молодежка', 'episode': '80 серия', - 'episode_id': 40, + 'episode_number': 40, 'season': '2 сезон', - 'season_id': 2, + 'season_number': 2, 'thumbnail': 're:^https?://.*\.jpg', 'duration': 2809, 'age_limit': 16, @@ -62,9 +62,9 @@ class VideomoreIE(InfoExtractor): 'description': 'Молодежка 3 сезон скоро', 'series': 'Молодежка', 'episode': 'Команда проиграла из-за Бакина?', - 'episode_id': None, + 'episode_number': None, 'season': 'Промо', - 'season_id': 99, + 'season_number': 99, 'thumbnail': 're:^https?://.*\.jpg', 'duration': 29, 'age_limit': 16, @@ -128,9 +128,9 @@ class VideomoreIE(InfoExtractor): series = data.get('project_title') episode = data.get('title') - episode_id = data.get('episode_of_season') or None + episode_number = int_or_none(data.get('episode_of_season') or None) season = data.get('season_title') - season_id = data.get('season_pos') or None + season_number = int_or_none(data.get('season_pos') or None) return { 'id': video_id, @@ -138,9 +138,9 @@ class VideomoreIE(InfoExtractor): 'description': description, 'series': series, 'episode': episode, - 'episode_id': episode_id, + 'episode_number': episode_number, 'season': season, - 'season_id': season_id, + 'season_number': season_number, 'thumbnails': thumbnails, 'timestamp': timestamp, 'duration': duration, From 5bafcf65255261c2dc6482de6b1e545e5de1cbee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergey=20M=E2=80=A4?= Date: Fri, 1 Jan 2016 20:34:29 +0600 Subject: [PATCH 6/6] [udemy] Use chapter_number --- youtube_dl/extractor/udemy.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/youtube_dl/extractor/udemy.py b/youtube_dl/extractor/udemy.py index 41097829d..1df636779 100644 --- a/youtube_dl/extractor/udemy.py +++ b/youtube_dl/extractor/udemy.py @@ -245,7 +245,7 @@ class UdemyCourseIE(UdemyIE): course_id, 'Downloading course curriculum') entries = [] - chapter, chapter_id = None, None + chapter, chapter_number = None, None for asset in response: asset_type = asset.get('assetType') or asset.get('asset_type') if asset_type == 'Video': @@ -256,13 +256,13 @@ class UdemyCourseIE(UdemyIE): 'url': 'https://www.udemy.com/%s/#/lecture/%s' % (course_path, asset['id']), 'ie_key': UdemyIE.ie_key(), } - if chapter_id: - entry['chapter_id'] = chapter_id + if chapter_number: + entry['chapter_number'] = chapter_number if chapter: entry['chapter'] = chapter entries.append(entry) elif asset.get('type') == 'chapter': - chapter_id = asset.get('index') or asset.get('object_index') + chapter_number = asset.get('index') or asset.get('object_index') chapter = asset.get('title') return self.playlist_result(entries, course_id, course_title)