2

Not sure if this is possible, god save me from doing html regex parsing.

So I have a friend that wants a premier league (english football leauge) standings feeds on his website. I've been trying to read the wikipedia api and can't seem to find a way to convert this html element into json map. My query looks like this, very dirty, any help well appreciated.

https://en.wikipedia.org/w/api.php?format=json&action=parse&page=2015%E2%80%9316_Premier_League&format=json&prop=text&section=6&callback=?

Here is the element Im trying to target: https://en.wikipedia.org/wiki/2015%E2%80%9316_Premier_League#League_table

Hlöðver
  • 101
  • 1
  • 7
  • I don't totally understand (if at all) the scope of your problem. Are you trying to extract this markup of the "League table" (buried in that JSON) and then to render it as-is in some other outer/container markup you were given, or are you trying to extract that markup to map it into another JSON more malleable for whatever further processing you have in mind? Or is it about doing something else I completely missed? – YSharp Mar 15 '16 at 00:31
  • Yes that later one. I would like to see a json map somehow like this { "Leicester City F.C.", { "played":"30" "won" : "18" ... }} or just {"table" { "row1" {"col1" {"value": "Leicester" .... etc.... So I have a json map that I can work with and style with javascript. Like I said, not sure if this is possible. – Hlöðver Mar 15 '16 at 17:33
  • Then, yes, I think this is possible without too much effort. I'll try to come up later with an example using a shorter data sample, but following the same structure (excerpt from yours). – YSharp Mar 16 '16 at 01:34
  • Possible duplicate of [HTML Table to JSON](http://stackoverflow.com/questions/6271856/html-table-to-json), [Converting Html Table to JSON](http://stackoverflow.com/questions/21461102/converting-html-table-to-json) – Tgr Mar 20 '16 at 23:52
  • Have you already ensured that Wikidata doesn't hold this information and therefore can't be used? http://stackoverflow.com/a/33862337/1333493 If so, please file your complaint at https://en.wikipedia.org/w/index.php?title=Wikipedia_talk:WikiProject_Football&action=edit&section=new :) – Nemo Jun 11 '16 at 20:58

0 Answers0