mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-13 14:37:43 +01:00
[udemy] Extract chapter info
This commit is contained in:
parent
7109903e61
commit
4d402db521
@ -244,10 +244,25 @@ def _real_extract(self, url):
|
|||||||
'https://www.udemy.com/api-1.1/courses/%s/curriculum' % course_id,
|
'https://www.udemy.com/api-1.1/courses/%s/curriculum' % course_id,
|
||||||
course_id, 'Downloading course curriculum')
|
course_id, 'Downloading course curriculum')
|
||||||
|
|
||||||
entries = [
|
entries = []
|
||||||
self.url_result(
|
chapter, chapter_id = None, None
|
||||||
'https://www.udemy.com/%s/#/lecture/%s' % (course_path, asset['id']), 'Udemy')
|
for asset in response:
|
||||||
for asset in response if asset.get('assetType') or asset.get('asset_type') == 'Video'
|
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)
|
return self.playlist_result(entries, course_id, course_title)
|
||||||
|
Loading…
Reference in New Issue
Block a user