Created
August 9, 2015 02:01
-
-
Save abeyer/1ce122ac551a4ed09e6d to your computer and use it in GitHub Desktop.
This file contains 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
/* | |
* 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