[Mediawiki-api] How to parse the contents

kracekumar ramaraju kracethekingmaker at gmail.com
Sat Dec 31 16:53:50 UTC 2011


Hello


http://en.wiktionary.org/w/api.php?format=json&action=query&titles=murky&rvprop=content&prop=revisions&redirects=1

yields json contents for the word 'murky'.

content = json_returned_content.
content

{"query":{"pages":{"54377":{"pageid":54377,"ns":0,"title":"murky","revisions":[{"*":"==English==\n\n===Etymology===\nCognate
to or directly from {{etyl|non}} {{term|myrkr}}.  Compare Russian,
Serbian [[\u043c\u0440\u0430\u043a]].\n\n===Pronunciation===\n*
{{audio|en-us-murky.ogg|Audio (US)}}\n\n*
{{rhymes|\u025c\u02d0(r)ki}}\n\n===Adjective===\n{{en-adj|murkier|murkiest}}\n\n#
Hard to see through, as a fog or mist.\n# [[gloomy|Gloomy]], [[dark]],
[[dim]].\n# [[obscure|Obscure]], [[indistinct]], [[cloudy]].\n#
Dishonest, [[shady]].\n\n====Synonyms====\n* [[dark]]\n\n====Related
terms====\n* [[murk]]\n* [[murkily]]\n*
[[murkiness]]\n\n====Translations====\n{{trans-top|hard to see
through}}\n* Dutch: [[troebel]], [[troebele]]\n* Finnish:
{{t+|fi|samea}}\n* French: {{t+|fr|sombre}}, {{t+|fr|trouble}}\n*
German: {{t+|de|d\u00fcster}}, {{t+|de|tr\u00fcb}}\n{{trans-mid}}\n*
Romanian: {{t-|ro|tulbure}}\n* Russian:
{{t|ru|\u043c\u0443\u0442\u043d\u044b\u0439|tr=m\u00fatnyj}}\n*
[[Scots]]: {{t\u00f8|sco|mirk|xs=Scots}}\n{{trans-bottom}}\n{{trans-see|gloomy}}\n{{trans-see|obscure}}\n{{trans-top|dishonest,
shady}}\n* Russian:
{{t+|ru|\u0442\u0451\u043c\u043d\u044b\u0439|tr=t'\u00f3mnyj}},
{{t+|ru|\u0433\u0440\u044f\u0437\u043d\u044b\u0439|tr=gr'\u00e1znyj}}\n{{trans-mid}}\n{{trans-bottom}}\n{{checktrans-top}}\n*
{{ttbc|da}}: {{t-|da|m\u00f8rk}}, {{t-|da|dunkel}},
{{t-|da|dyster}}\n* {{ttbc|he}}: [[\u05e2\u05db\u05d5\u05e8,
\u05de\u05d8\u05d5\u05e9\u05d8\u05e9]]\n{{trans-mid}}\n* {{ttbc|is}}:
[[myrkr]]\n{{trans-bottom}}\n\n====External links====\n* {{R:Webster
1913}}\n* {{R:Century
1911}}\n\n[[et:murky]]\n[[io:murky]]\n[[kn:murky]]\n[[lt:murky]]\n[[hu:murky]]\n[[mg:murky]]\n[[ml:murky]]\n[[my:murky]]\n[[pl:murky]]\n[[ru:murky]]\n[[fi:murky]]\n[[sv:murky]]\n[[ta:murky]]\n[[te:murky]]\n[[vi:murky]]\n[[zh:murky]]"}]}}}}

content['query']['pages']['54377']['revisions][0]['*'] yields meaning
and other related contents.


I am interested to retrieve the meaning of the word. how can I do it?

In this scenario I find api to be unusable since pageid is dynamically
generated which is required to access the contents.


Yes I can use xml and find contents inside <rev></rev> tag, but how
will some one fetch synonym alone and part of speech alone?



-- 
*
Thanks & Regards

"Talk is cheap, show me the code" -- Linus Torvalds
kracekumar
www.kracekumar.com
*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wikimedia.org/pipermail/mediawiki-api/attachments/20111231/0cbd7f47/attachment.htm 


More information about the Mediawiki-api mailing list