https://pegacert.com/vendor/aws/ urls = [...document.querySelectorAll('div.row > div > a')].map(e => e.href.replace('/vendor', '/page-data/vendor') + '/' + 'page-data.json') questions = await Promise.all(urls.map(async (u) => { resp = await fetch(u); json = await resp.json(); return json.result.pageContext.question; })); exam = questions.map(q => { return { id : q.id, text: q.description.map(d => d.text).join('\r\n'), answers : q.choices.map(a => a.text.map(t=> t.text).join('\r\n')) }}); https://pegacert.com/vendor/microsoft/az-900 urls = [...document.querySelectorAll('div.row > div > a')].map(e => e.href.replace('/vendor', '/page-data/vendor') + '/' + 'page-data.json') questions = await Promise.all(urls.map(async (u) => { resp = await fetch(u); json = await resp.json(); return json.result.pageContext.question; })); exam = questions.map(q => { return { id : q.id, text: q.description.map(d => d.text).join(), answers : q.choices?.map(a => a.text.map(t=> t.text).join('\r\n')), image : q.image }}); imgUrl = 'https://pegacert.s3-ap-southeast-1.amazonaws.com/microsoft/az-900/b1945/images/'; images = [...new Set(questions .filter(q=>q.image) .map(q => 'wget ' + imgUrl + q.image + '.png'))] .join('\r\n')