mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-30 13:50:48 -05:00
[lynda] Extract chapter metadata (#8993)
This commit is contained in:
parent
4cf3489c6e
commit
00322ad4fd
1 changed files with 11 additions and 9 deletions
|
@ -219,7 +219,7 @@ def _real_extract(self, url):
|
|||
'Course %s does not exist' % course_id, expected=True)
|
||||
|
||||
unaccessible_videos = 0
|
||||
videos = []
|
||||
entries = []
|
||||
|
||||
# Might want to extract videos right here from video['Formats'] as it seems 'Formats' is not provided
|
||||
# by single video API anymore
|
||||
|
@ -229,20 +229,22 @@ def _real_extract(self, url):
|
|||
if video.get('HasAccess') is False:
|
||||
unaccessible_videos += 1
|
||||
continue
|
||||
if video.get('ID'):
|
||||
videos.append(video['ID'])
|
||||
video_id = video.get('ID')
|
||||
if video_id:
|
||||
entries.append({
|
||||
'_type': 'url_transparent',
|
||||
'url': 'http://www.lynda.com/%s/%s-4.html' % (course_path, 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')),
|
||||
})
|
||||
|
||||
if unaccessible_videos > 0:
|
||||
self._downloader.report_warning(
|
||||
'%s videos are only available for members (or paid members) and will not be downloaded. '
|
||||
% unaccessible_videos + self._ACCOUNT_CREDENTIALS_HINT)
|
||||
|
||||
entries = [
|
||||
self.url_result(
|
||||
'http://www.lynda.com/%s/%s-4.html' % (course_path, video_id),
|
||||
'Lynda')
|
||||
for video_id in videos]
|
||||
|
||||
course_title = course.get('Title')
|
||||
|
||||
return self.playlist_result(entries, course_id, course_title)
|
||||
|
|
Loading…
Reference in a new issue