It is not technically illegal as you are only bypassing the pathway, but it might be illegal based on your country's YouTube or any YouTube videos that are geo-restricted.