public paste
Fixing YouTube HTTP 403 (Forbidden) in yt-dlp (2026)
—134 views2,092 chars
stdout
Paste content
Fixing YouTube HTTP 403 (Forbidden) in yt-dlp (2026)
Recently, many users have encountered the following error:
ERROR: unable to download video data: HTTP Error 403: Forbidden
This happens even when:
Using the latest yt-dlp
Providing valid YouTube cookies
Enabling a JavaScript runtime (node)
Using --remote-components ejs:github
Solution
Force yt-dlp to use the web, web_embedded, and tv player clients instead of the default client.
Bash Example
yt-dlp \
--cookies cookies.txt \
--remote-components ejs:github \
--js-runtimes node \
--extractor-args "youtube:player_client=web_embedded,web,tv" \
-f "bestvideo*+bestaudio/best" \
--merge-output-format mp4 \
"https://youtu.be/VIDEO_ID"
If you only want audio:
yt-dlp \
--cookies cookies.txt \
--remote-components ejs:github \
--js-runtimes node \
--extractor-args "youtube:player_client=web_embedded,web,tv" \
-f bestaudio \
-x \
--audio-format mp3 \
"https://youtu.be/VIDEO_ID"
Node.js Example
const yt = spawn('yt-dlp', [
'--cookies', 'cookies.txt',
'--remote-components', 'ejs:github',
'--js-runtimes', 'node',
'--extractor-args',
'youtube:player_client=web_embedded,web,tv',
'--no-playlist',
'--concurrent-fragments', '4',
'-f', 'bestvideo*+bestaudio/best',
'--merge-output-format', 'mp4',
'-o', filePath,
url
]);
Why This Works
Some recent YouTube updates cause certain player clients (especially the default/iOS-based ones) to receive HTTP 403 Forbidden responses when downloading media streams.
By forcing yt-dlp to use:
web_embedded,web,tv
the generated download URLs are accepted by Google's video servers, allowing downloads to proceed normally.
Requirements
Latest yt-dlp
Valid cookies.txt
Node.js installed (for JS challenge solving)
yt_dlp_ejs
ffmpeg
Result
Before:
ERROR: unable to download video data: HTTP Error 403: Forbidden
After:
[download] 100% of video
[download] 100% of audio
[Merger] Merging formats...
Downloads should complete successfully without the HTTP 403 error.$ tail -f comments.log
Comments [0]
// no comments yet