Skip to content

Commit

Permalink
Avoid crashing if n-sig decode fails
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkf committed Feb 2, 2022
1 parent 34c06b1 commit 41f0043
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion youtube_dl/extractor/youtube.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
ExtractorError,
clean_html,
dict_get,
error_to_compat_str,
float_or_none,
int_or_none,
js_to_json,
Expand Down Expand Up @@ -1463,7 +1464,12 @@ def _n_descramble(self, n_param, player_url, video_id):
self._downloader.to_screen('[debug] [%s] %s' % (self.IE_NAME, 'Decrypted nsig {0} => {1}'.format(n_param, self._player_cache[sig_id])))
return self._player_cache[sig_id]
except Exception as e:
raise ExtractorError(traceback.format_exc(), cause=e, video_id=video_id)
self._downloader.report_warning(
'[%s] %s (%s %s)' % (
self.IE_NAME,
'Unable to decode n-parameter: download likely to be throttled',
error_to_compat_str(e),
traceback.format_exc()))

def _unthrottle_format_urls(self, video_id, player_url, formats):
for fmt in formats:
Expand Down

0 comments on commit 41f0043

Please sign in to comment.