Youtube’s quality isn’t as bad as it’s used to be, in fact you can get pretty high quality aac and opus streams given that the upload had legit quality and your using legit software to download and not some shitty webapp.
Although it is not recommended, YouTube accepts compressed audio. YouTube transcodes from the delivered format; audio quality is much better when transcoded from a lossless format compared to re-compressing a lossy audio format.
If you must deliver compressed audio, use these specifications:
Codec: AAC-LC
Sample Rate: 44.1Khz
Bit Rate: 320kbps or higher for 2 channels (higher is always better; 256 kbps acceptable)
Channels: 2 (stereo)