Skip to content

Instantly share code, notes, and snippets.

@jamesduncombe
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesduncombe/d7161540bf51d45a69ce to your computer and use it in GitHub Desktop.
Save jamesduncombe/d7161540bf51d45a69ce to your computer and use it in GitHub Desktop.
Duolingo vocab parser for Words page
/* Pulling out vocab from Duolingo's Words page */
var raw,
cleaned,
filtered,
xhr = new XMLHttpRequest;
var parser = function(data) {
raw = JSON.parse(data);
cleaned = raw.vocab_overview.filter(function(word) {
if (word.strength_bars < 3) {
return true;
}
});
filtered = cleaned.map(function(d) {
return d.normalized_string;
});
console.dir(filtered);
}
xhr.open('GET', '/vocabulary/overview?_=1410893871725', true);
xhr.responseType = 'text';
xhr.onload = function() {
if (this.status == 200) {
parser(this.response)
}
}
xhr.send();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment