Created
May 5, 2012 22:32
-
-
Save bnoguchi/2605994 to your computer and use it in GitHub Desktop.
phishApi html destructuring
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
destructure = (s) -> s.split("</a>").map (x) -> title: x[x.lastIndexOf('>')+1..], url: x.match(/href="([^"]+)"/)?[1] | |
reduceCb = (mem, curr) -> mem[curr[0...curr.indexOf ':']] = destructure curr; mem | |
dataBySetNumber = json.setlistdata.split(/<span[^>]+>Set /)[1..].reduce reduceCb, {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment