Relying solely on YouTube as a primary source of income is not inherently against the law, as there are many individuals and businesses who have built successful careers and revenue streams through the platform. However, it is important to note that YouTube's terms of service, as well as local laws and regulations, must be followed in order to avoid potential legal issues.
For example, YouTube's terms of service prohibit certain types of content, such as copyrighted material, hate speech, and content that violates community guidelines. Additionally, YouTubers who earn income through the platform are subject to taxation laws, and may be required to register as a business and pay taxes on their earnings.
It's important for creators to carefully read and understand YouTube's terms of service, as well as consult with a qualified attorney or accountant to ensure that they are complying with all relevant laws and regulations