Skip to content

Commit

Permalink
[youtube] do n-sig decryption for WEB-ish clients
Browse files Browse the repository at this point in the history
  • Loading branch information
Lesmiscore committed Nov 27, 2021
1 parent 71830d5 commit fc3e58c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions yt_dlp/extractor/youtube.py
Original file line number Diff line number Diff line change
Expand Up @@ -2556,8 +2556,9 @@ def _extract_formats(self, streaming_data, video_id, player_url, is_live):
fmt_url += '&' + sp + '=' + signature

query = parse_qs(fmt_url)
client_name = traverse_obj(query, ('c', 0), expected_type=compat_str, default='')
throttled = False
if query.get('ratebypass') != ['yes'] and query.get('n'):
if (query.get('ratebypass') != ['yes'] or 'WEB' in client_name) and query.get('n'):
old_n, new_n = query['n'][0], None
warn_message, err = None, None
try:
Expand All @@ -2575,7 +2576,6 @@ def _extract_formats(self, streaming_data, video_id, player_url, is_live):
player_id = self._extract_player_info(player_url, fatal=False) or player_url or 'PLAYER UNKNOWN'
self.report_warning(f'nsig extraction failed: You may experience throttling for some formats. {warn_message}\nplayer id: {player_id} , nsig value: {old_n}\n{err}', only_once=True)

client_name = traverse_obj(query, ('c', 0), expected_type=compat_str)
if client_name:
client_name = client_name[0:3]

Expand Down

0 comments on commit fc3e58c

Please sign in to comment.