function parseHTML(htmltext) { return new DOMParser().parseFromString(htmltext, 'text/html'); } fetch('https://www.bradsdeals.com/stores/all').then(response => response.text()) .then(html => { const dom = parseHTML(html); const linkDetails = dom.querySelectorAll('#a > section > ul > li'); [...linkDetails].map(async (link) => { const linkDetail = link.firstElementChild.getAttribute('href'); const response = await fetch('https://www.bradsdeals.com' + linkDetail); const html = await response.text(); const dom = parseHTML(html); const tag = [...dom.querySelectorAll('body > script')].slice(-2)[0]; const urlHome = tag.innerText.match(/site_url":"(.+?)"/g); if (urlHome && urlHome.length > 0) console.log(urlHome[0]); }) })