Read below if interested in a much more powerful new software tool available
(Only available circa the past ~5 years due to advances in the fields of machine learning [esp. "deep learning"] in computer science software)
For a a full example of extracting an mp3 sound file from a youtube video (in this case a piano concerto, so, not only piano, but a large ensemble orchestral accompaniments layered on top as well! - Rachmaninoff's famous Variation from his Paganini Variations Rhapsody piece, feat. the mesmerizing, practically divinely talented pianist...)
Huge advances have/are recently being made in regards to software that addresses tasks precisely like this one (and many others, such as image classification, "deep fake" video generation, natural language processing summarization, speech recognition, etc.), due principally to the arrival of new techniques I'm sure we've all (or mostly have) heard of -- that is, Deep Learning. By far the best software for this I am aware of yet is called "AnthemScore". It's pretty incredible what it can do.
https://www.lunaverus.com/
So here is an example (same one as can be found in my other answer: )... This took less than 5 minutes including the downloading of the mp3 from youtube.
https://music.stackexchange.com/a/118388/74688
And here's what it looked like in AnthemScore (notice the detection of notes clearly being based off of visualizing the fundamental frequencies of the various harmonics present - ultimately this is actually visual machine learning, just like Google's famous image recognition deep learning methods)