Playing offline YouTube videos with screen locked
You can try using SnapTube. It let's you download videos (or just the audio) from a number of sources, including Youtube. If you download only the audio, you can just use any standard audio player (or the built-in one) to listen to it with the screen off.

Disclaimer: not sure how this fits with Youtube terms of service, you may want to investigate that before using it on Youtube.