Skip to content

Instantly share code, notes, and snippets.

@abeyer
Created August 9, 2015 02:01
Show Gist options
  • Save abeyer/1ce122ac551a4ed09e6d to your computer and use it in GitHub Desktop.
Save abeyer/1ce122ac551a4ed09e6d to your computer and use it in GitHub Desktop.
/*
* Scrapes text Q&A data out of a Quizlet deck list view
*
* usage: paste this function into developer console, then
* copy(scrape_quizlet()) to get a JSON string on
* the clipboard.
*/
function scrape_quizlet() {
var get_text = function(i,elem) { return jQuery(elem).text(); };
var words = jQuery('.terms .term .word').map(get_text).get(),
defs = jQuery('.terms .term .definition').map(get_text).get();
var cards = [];
jQuery.each(words, function(i,_) {
cards.push([words[i], defs[i]]);
});
return JSON.stringify(cards);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment