The local laws always have precedence over any rules or restrictions imposed by YouTube. While YouTube terms of service explicitly forbids downloading videos from its streaming platform, the laws of your country may say otherwise. There are two sides of the question: what YouTube says, and what your country’s national laws say.