0

I am actively studying front-end development now, and for better retention of the material I create flashcards in Anki. How can I automatically extract data from the table on this page and save it in a format "question (property) --- answer (description);"?

  • Are you trying to save it to a database? What is the end goal? – Cameron Askew Feb 21 '14 at 02:34
  • End goal is to paste this data into Anki (spaced repetition software) and cram things like "what Math.ceil() does" etc. –  Feb 21 '14 at 03:08
  • you haver permission for that site? if your going to steal don't steal from what is considerer by many to be the most dangerously useless resource on the interweb –  Feb 21 '14 at 03:09
  • I have heard that opinion before. What the problem with that site? Just now i'm reading rhino-book (javascript: definitive guide lol) and plan to use the tables from the site only to repeat already learned information. –  Feb 21 '14 at 03:16

2 Answers2

1

Because of the same origin policy, you will have to download the HTML with something besides Javascript. You could run a locally hosted server, download and parse the HTML, then send the data to a browser via JSON or XML and display it at that point.

Cameron Askew
  • 1,403
  • 1
  • 12
  • 20
0

Agree with @Cameron Askew . You can use a server side language like: php, java or nodejs to fetch the html document and analysis it with regex then use ajax in client side to get it.

Tyler.z.yang
  • 2,402
  • 1
  • 18
  • 31
  • Parse HTML with Regex! [AHHHH](http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags). lol, that's a funny read if you haven't read yet. But yeah, parsing a simple table with regex is pbb fine, but I like XML parsers, make life easier I think! – Cameron Askew Feb 21 '14 at 02:44
  • You are right, regex is not the best way. To parse the html like javascript dom will be a better way. Thx for reminding me~. : ) – Tyler.z.yang Feb 21 '14 at 03:04