Connect with us

Hi, what are you looking for?

Fix “Unable to download video data: HTTP Error 403: Forbidden”

Hosting

Fix “Unable to download video data: HTTP Error 403: Forbidden”

Youtube-dl is my favorite and preferred command line download manager. I often use it to download audios, videos and movies from Internet. Today, I tried to download a video from YouTube using youdtube-dl from my Linux desktop and got this error message – Unable to download video data: HTTP Error 403: Forbidden. Usually, most youtube-dl errors will be fixed after updating youtube-dl. So I updated youtube-dl using command:

$ sudo youtube-dl -U

It is already updated! I have the most recent version. Hop over to this site Outsource hosting support.

And then I tried again to download the video with command:

$ youtube-dl https://www.youtube.com/watch?v=4jTy5jnMkYc

But I get the same error:

[youtube] 4jTy5jnMkYc: Downloading webpage
WARNING: Requested formats are incompatible for merge and will be merged into mkv.
ERROR: unable to download video data: HTTP Error 403: Forbidden

If you ever encountered with this error, follow the steps given below to fix it.

Fix “Unable to download video data: HTTP Error 403: Forbidden” Error When Downloading Media Files With Youtube-dl In Linux

This error will probably happen because of Youtube-dl cache. To fix it, simply remove the cache for youtube-dl using command:

$ youtube-dl –rm-cache-dir

This command command will remove the local caching directory for youtube-dl. In my case, it removed the following directory:

Removing cache dir /home/sk/.cache/youtube-dl …

Fix “Unable to download video data: HTTP Error 403: Forbidden”

If you use Youtube-dl in Python code, the following will help to fix this error.

# ‘cachedir’: False -> don’t use a local caching dir (~/.cache/youtube-dl)
ydl_opts = {…,
‘cachedir’: False
}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
result = ydl.extract_info(url)

Now, I can be able to download the youtube videos without any issues.

$ youtube-dl https://www.youtube.com/watch?v=4jTy5jnMkYc
[youtube] 4jTy5jnMkYc: Downloading webpage
[youtube] 4jTy5jnMkYc: Downloading js player vflset
[youtube] 4jTy5jnMkYc: Downloading js player vflset
WARNING: Requested formats are incompatible for merge and will be merged into mkv.
[download] Destination: Takkar _ Nira Song Lyric Video _ Siddharth _ Sid Sriram _ Gautham Menon _ Nivas K Prasanna-4jTy5jnMkYc.f137.mp4
[download] 100% of 29.87MiB in 00:24
[download] Destination: Takkar _ Nira Song Lyric Video _ Siddharth _ Sid Sriram _ Gautham Menon _ Nivas K Prasanna-4jTy5jnMkYc.f251.webm
[download] 100% of 5.10MiB in 00:04
[ffmpeg] Merging formats into “Takkar _ Nira Song Lyric Video _ Siddharth _ Sid Sriram _ Gautham Menon _ Nivas K Prasanna-4jTy5jnMkYc.mkv”
Deleting original file Takkar _ Nira Song Lyric Video _ Siddharth _ Sid Sriram _ Gautham Menon _ Nivas K Prasanna-4jTy5jnMkYc.f137.mp4 (pass -k to keep)
Deleting original file Takkar _ Nira Song Lyric Video _ Siddharth _ Sid Sriram _ Gautham Menon _ Nivas K Prasanna-4jTy5jnMkYc.f251.webm (pass -k to keep)

As you may probably noticed, there is a warning message in the above command:

[…]
WARNING: Requested formats are incompatible for merge and will be merged into mkv.
[…]

This is not actually a problem but an expected behavior for youtube-dl command. By default, youtube-dl will download the highest quality audio and the highest quality video streams available and then join them into a compatible container like mkv, mp4 etc.  If these audio and video streams doesn’t fit well in an mp4 container, youtube-dl will then pack them in mkv container and display the above warning message. In such cases, you can ignore the mkv warning and download the best quality video and the best quality audio but only in an mp4 container by explicitly mentioning the desired best quality audio and video formats like below:

$ youtube-dl -f ‘bestvideo[ext=mp4]+bestaudio[ext=m4a]’ https://www.youtube.com/watch?v=4jTy5jnMkYc

For more Youtube-dl command examples, refer the following guide.

Hope this helps.

Thanks for stopping by!

Help us to help you:

Have a Good day!!error: unable to download video data: http error 403: forbidden

You May Also Like

Hosting

Malware maker urges judge to dump lawsuit over WhatsApp phone snooping Hey boss, this is what people imagine when they think of California –...

Hosting

We’re at the end of the house! The best host company that has been active in this field for the past 6 years. Because...

Hosting

Servers can be unpredictable, hence your sites! The website may break down for reasons such as incorrect file processing, authorization problems, website updates, etc....

Hosting

Java is the most popular, reliable and platform-independent object-oriented programming language. Your system requires multiple applications that require Java on your system. This guide...