Last active
June 2, 2022 12:28
-
-
Save GitHub30/1381710ffb2e35238d69ed9f57d89b5d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const parse = url => fetch(url).then(r=>r.text()).then(html=>new DOMParser().parseFromString(html,'text/html')) | |
const docs = [await parse('https://www.cloudskillsboost.google/catalog?skill-badge%5B%5D=skill-badge')] | |
while(docs.at(-1).querySelector('[rel="next"]')) docs.push(await parse(docs.at(-1).querySelector('[rel="next"]')?.href)) | |
const questUrls = docs.flatMap(doc => [...doc.querySelectorAll('[href^="/quests/"]')]).map(a => a.href) | |
const questDocs = [] | |
for await (const questUrl of questUrls) questDocs.push(await parse(questUrl)) | |
questDocs.flatMap(doc => [...doc.querySelectorAll('h3>[href^="/focuses"]')]).filter(a=>a.textContent.includes('チャレンジラボ')).map(a=>a.textContent) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment