Hi guys,

I am writing a ruby application to retrieve the wikipedia data: the main description and the main image (the one on the box in the left side). 
As parameter I have the cruid of the wiki page, so I call the wiki API to get the data, now start the problems:

- Main description:
I call the following link to retrieve the json object with the data of the main description

http://en.wikipedia.org/w/api.php?action=query&pageids=52780&prop=revisions&rvprop=content&rvsection=0&format=json
the object is well formed but the text is on wikipedia format.

How is possible to convert it into a plain text? (without {{ }}, [ ] and <ref>)
is it possible to get a text plain directly ?


- Main img (if present)
my second problem is to find the right image to show after a research

I have tried to fetch the main image of a wiki page using the following link:
http://en.wikipedia.org/w/api.php?action=query&pageids=52780&prop=images&format=json

but this object that i receive contains all the images of the page without specify where this images are used.

how is possible to know exactly the image used on the left box of the wiki page?

anyone can help me?



Kind regards
Marco