Error while using youtube-dl [duplicate]

My fault:

I installed youtube-dl using command : sudo apt-get install youtube-dl

What should I have done:

I should have used commands (either one):

either

sudo curl -L https://yt-dl.org/latest/youtube-dl -o /usr/local/bin/youtube-dl
sudo chmod a+rx /usr/local/bin/youtube-dl

or

sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl
sudo chmod a+rx /usr/local/bin/youtube-dl

I used the first one and then it worked correctly.