This commit is contained in:
rootyElf 2020-09-27 02:37:27 +02:00 committed by GitHub
commit fe47ce5d0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 2 deletions

View File

@ -310,7 +310,23 @@ class LyndaCourseIE(LyndaBaseIE):
unaccessible_videos = 0
entries = []
template_vars = {}
date = course.get('DateReleasedUtc')
if isinstance(date, str) and len(date) > 10:
date = date[6:10] + date[0:2] + date[3:5]
template_vars.update({'release_date': date})
authors = course.get("Authors")
if authors and isinstance(authors, list):
author_string = ''
for author in authors:
if isinstance(author, dict):
name = author.get("Fullname")
if isinstance(name, str) and name:
author_string += name + ", "
author_string = author_string[:-2]
template_vars.update({'creator': author_string})
# Might want to extract videos right here from video['Formats'] as it seems 'Formats' is not provided
# by single video API anymore
@ -321,14 +337,16 @@ class LyndaCourseIE(LyndaBaseIE):
continue
video_id = video.get('ID')
if video_id:
entries.append({
entry = {
'_type': 'url_transparent',
'url': item_template % video_id,
'ie_key': LyndaIE.ie_key(),
'chapter': chapter.get('Title'),
'chapter_number': int_or_none(chapter.get('ChapterIndex')),
'chapter_id': compat_str(chapter.get('ID')),
})
}
entry.update(template_vars)
entries.append(entry)
if unaccessible_videos > 0:
self._downloader.report_warning(