const url = 'http://www.youtube.com/watch?v=ClkQA2Lb_iE'; const { hostname } = new URL(url); console.assert(hostname === 'www.youtube.com'); // true