Fix - ERROR: unable to download video data: HTTP Error 403: Forbidden

logo

When you want to download a youtube video and you have this:

 $ youtube-dl  https://youtu.be/JkeE2O15RFs
   [youtube] JkeE2O15RFs: Downloading webpage
   ERROR: unable to download video data: HTTP Error 403: Forbidden
 

You can try to fix with 2 steps:

First update youtube-dl with -U

 $ sudo youtube-dl -U

And finally try to remove the cache , yes the cache ... with --rm-cache-dir

 $ youtube-dl --rm-cache-dir
    Removing cache dir /root/.cache/youtube-dl ...

Try now :

 $ youtube-dl  https://youtu.be/JkeE2O15RFs  --no-cache-dir  -f "bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best" 
    [youtube] JkeE2O15RFs: Downloading webpage
    [youtube] JkeE2O15RFs: Downloading js player vflset
    [youtube] JkeE2O15RFs: Downloading js player vflset
    [download] Destination: Beastie Boys - Alive (Official Music Video)-JkeE2O15RFs.f137.mp4
    [download] 100% of 68.01MiB in 00:06
    [download] Destination: Beastie Boys - Alive (Official Music Video)-JkeE2O15RFs.f140.m4a
    [download] 100% of 3.71MiB in 00:00
    [ffmpeg] Merging formats into "Beastie Boys - Alive (Official Music Video)-JkeE2O15RFs.mp4"
    Deleting original file Beastie Boys - Alive (Official Music Video)-JkeE2O15RFs.f137.mp4 (pass -k to keep)
    Deleting original file Beastie Boys - Alive (Official Music Video)-JkeE2O15RFs.f140.m4a (pass -k to keep)

You can put --no-cache-dir to your command to avoid this, or delete the cache.

 $ youtube-dl  https://youtu.be/JkeE2O15RFs  --no-cache-dir  
 alias ytdl='youtube-dl  -o "%(title)s.%(ext)s" --extract-audio --audio-format mp3 -k --force-ipv4  --rm-cache-dir $1'
 alias ytdlV='youtube-dl  -o "%(title)s.%(ext)s" --force-ipv4 $1'

First line download and keep both video and mp3.
Second line download and keep only vdieo.
Bonus: --rm-cache-dir Delete cache from video file.

Enjoy! :)

by πŸ…΄πŸ†πŸ†πŸ…΄πŸ†„πŸ†32
πŸ…΄πŸ…²πŸ…·πŸ”΅πŸ†‚πŸ†ˆπŸ†‚πŸ†ƒπŸ…΄πŸ…Ό