mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-25 14:53:12 +00:00
[udemy] Make lecture downloading fatal
This commit is contained in:
parent
9fc87fa767
commit
24121bc703
1 changed files with 3 additions and 3 deletions
|
@ -57,7 +57,7 @@ def _download_lecture(self, course_id, lecture_id):
|
||||||
'fields[asset]': 'asset_type,stream_url,thumbnail_url,download_urls,data',
|
'fields[asset]': 'asset_type,stream_url,thumbnail_url,download_urls,data',
|
||||||
'instructorPreviewMode': 'False',
|
'instructorPreviewMode': 'False',
|
||||||
})),
|
})),
|
||||||
lecture_id, 'Downloading lecture JSON', fatal=False)
|
lecture_id, 'Downloading lecture JSON')
|
||||||
|
|
||||||
def _handle_error(self, response):
|
def _handle_error(self, response):
|
||||||
if not isinstance(response, dict):
|
if not isinstance(response, dict):
|
||||||
|
@ -70,7 +70,7 @@ def _handle_error(self, response):
|
||||||
error_str += ' - %s' % error_data.get('formErrors')
|
error_str += ' - %s' % error_data.get('formErrors')
|
||||||
raise ExtractorError(error_str, expected=True)
|
raise ExtractorError(error_str, expected=True)
|
||||||
|
|
||||||
def _download_json(self, url_or_request, video_id, note='Downloading JSON metadata', *args, **kwargs):
|
def _download_json(self, url_or_request, video_id, note='Downloading JSON metadata'):
|
||||||
headers = {
|
headers = {
|
||||||
'X-Udemy-Snail-Case': 'true',
|
'X-Udemy-Snail-Case': 'true',
|
||||||
'X-Requested-With': 'XMLHttpRequest',
|
'X-Requested-With': 'XMLHttpRequest',
|
||||||
|
@ -88,7 +88,7 @@ def _download_json(self, url_or_request, video_id, note='Downloading JSON metada
|
||||||
else:
|
else:
|
||||||
url_or_request = sanitized_Request(url_or_request, headers=headers)
|
url_or_request = sanitized_Request(url_or_request, headers=headers)
|
||||||
|
|
||||||
response = super(UdemyIE, self)._download_json(url_or_request, video_id, note, *args, **kwargs)
|
response = super(UdemyIE, self)._download_json(url_or_request, video_id, note)
|
||||||
self._handle_error(response)
|
self._handle_error(response)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue