]>
jfr.im git - yt-dlp.git/blob - yt_dlp/utils/networking.py
4 def random_user_agent():
5 _USER_AGENT_TPL
= 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Safari/537.36'
46 return _USER_AGENT_TPL
% random
.choice(_CHROME_VERSIONS
)
50 'User-Agent': random_user_agent(),
51 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
52 'Accept-Language': 'en-us,en;q=0.5',
53 'Sec-Fetch-Mode': 'navigate',
57 def clean_headers(headers
):
58 if 'Youtubedl-no-compression' in headers
: # compat
59 del headers
['Youtubedl-no-compression']
60 headers
['Accept-Encoding'] = 'identity'