Skip to content

Instantly share code, notes, and snippets.

@pigeonburger
Created April 8, 2022 04:53
Show Gist options
  • Save pigeonburger/43ff4a976867aa141ba3b0862c9d99d6 to your computer and use it in GitHub Desktop.
Save pigeonburger/43ff4a976867aa141ba3b0862c9d99d6 to your computer and use it in GitHub Desktop.
Quizlet to CSV file
/*
Converts a Quizlet set to a CSV file and downloads it to your computer.
HOW TO USE:
1. Open your browser's console
2. Copy all the below code into it, and press enter.
3. The list will be saved to your downloads as a CSV file!
*/
const terms = document.getElementsByClassName('SetPageTerms-term');
const csv = [`"term","definition"`];
Array.from(terms).forEach((term) => {
const word = term.querySelector('.SetPageTerm-wordText').textContent.replace(/[\n\r]+/g, '/');
const def = term.querySelector('.SetPageTerm-definitionText').textContent.replace(/[\n\r]+/g, '/');
csv.push(`"${word}","${def}"`);
});
var blob1 = new Blob([csv.join('\n')], { type: "text/plain;charset=utf-8" });
var url = window.URL || window.webkitURL;
link = url.createObjectURL(blob1);
var a = document.createElement("a");
a.download = `${document.querySelector('.SetPage-setTitle').textContent}.csv`;
a.href = link;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
@xvalentino
Copy link

Thank you so much for this 🥳

@niki777333
Copy link

Hey, when I use this column A is term, column B is definition. But under definition it just repeats the term. Any tips?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment