There is a mixed bag of information on this topic. Some people say it's legal.
And some people say it is not.
If I prefer the ToS then YouTube itself is doing illegal stuff as it offers to make videos offline.
If you ask me is it legal or not, I will say as long as you are not establishing the contents as your own and giving the content creators the proper value, it's not that harmful.
Also, there is no past history of google suing developers for downloading videos(at least I haven't seen one).
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.