There are several YouTube to mp3 converters available on the internet. However, YouTube’s Terms of Service prohibit downloading or converting videos unless available as an internal link or through YouTube’s download button.
Since the content on YouTube is copyrighted, it is illegal to download and use it in personal projects.