Last active
August 29, 2015 14:06
-
-
Save jamesduncombe/d7161540bf51d45a69ce to your computer and use it in GitHub Desktop.
Duolingo vocab parser for Words page
This file contains hidden or 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
/* 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