I will tell you step by step as how to do this, please follow the steps and you are good to go.
1. set the path of your chrome/ firefox driver you are going to use.
WebDriver driver = new ChromeDriver();
2. Open the youtube webpage
3. Get the id for the search box and type the keyword.
4. Click on the search key.
Hope this helps!