async function getChannelId(url) { return await fetch(url) .then(handleResponse) .then(handleData) .catch(handleError); function handleResponse(response) { return response.text(); } function handleError(error) { console.log(error) return error; } function handleData(data) { return data.split('https://www.youtube.com/feeds/videos.xml?channel_id=')[1].split('"')[0]; } } (async ()=> { var coiso = await getChannelId('https://www.youtube.com/@craftedworkshop'); console.log(coiso) })()