async function quizlet(id){ let res = await fetch(`https://quizlet.com/webapi/3.4/studiable-item-documents?filters%5BstudiableContainerId%5D=${id}&filters%5BstudiableContainerType%5D=1&perPage=5&page=1`).then(res => res.json()) let currentLength = 5; let token = res.responses[0].paging.token let terms = res.responses[0].models.studiableItem; let page = 2; console.log({token, terms}) while (currentLength >= 5){ let res = await fetch(`https://quizlet.com/webapi/3.4/studiable-item-documents?filters%5BstudiableContainerId%5D=${id}&filters%5BstudiableContainerType%5D=1&perPage=5&page=${page++}&pagingToken=${token}`).then(res => res.json()); terms.push(...res.responses[0].models.studiableItem); currentLength = res.responses[0].models.studiableItem.length; token = res.responses[0].paging.token; } return terms; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter