Like many social media platform providers, Google's TOS for YouTube contains restrictions on the usage of automated web scraping tools. The API, however, is less locked down than Meta's platforms Instagram and Facebook. YouTube has been successfully studied by researchers, albiet to a lesser degree than the text-based and easily available Twitter.
The YouTube API allows for automatic searching and collection of videos and video metadata. It is well-documented and there are non-coding free tools available to work with it.