Hi,

You will probably have to code a few things to get that information.
I would suggest :

   - Use the API to retrieve the content of section 0 of the page (all the
   wikitext before the first title)
   - Develop some code to parse this wikitext : retrieve the value of one
   parameter (example "image) of one template (example "Infobox politician")
   - Use the API to retrieve the image

The API has no know knowledge on how each project has decided to organize
pages (which infobox, ...), so I think you have to do the analysis of the
page text to retrieve information you want.

Nico

On Wed, May 9, 2012 at 12:38 PM, Krishna Kranth
<[email protected]>wrote:

> Dear Team,
>
> How can I get the image of a personality which is shown in info box in
> wikipedia pages. Please provide me with the query link.
>
>
> On Fri, Apr 27, 2012 at 6:45 PM, Tom Hutchison <[email protected]> wrote:
>
>> http://en.wikipedia.org/w/api.**php?format=xml&action=query&**
>> titles=The_Social_Network&**prop=revisions&rvprop=content<http://en.wikipedia.org/w/api.php?format=xml&action=query&titles=The_Social_Network&prop=revisions&rvprop=content><
>> http://en.wikipedia.org/w/**api.php?format=xml&action=**
>> query&titles=The_Social_**Network&prop=revisions&rvprop=**content<http://en.wikipedia.org/w/api.php?format=xml&action=query&titles=The_Social_Network&prop=revisions&rvprop=content>
>> >
>> or in json
>> http://en.wikipedia.org/w/api.**php?format=json&action=query&**
>> titles=The_Social_Network&**prop=revisions&rvprop=content<http://en.wikipedia.org/w/api.php?format=json&action=query&titles=The_Social_Network&prop=revisions&rvprop=content><
>> http://en.wikipedia.org/w/**api.php?format=json&action=**
>> query&titles=The_Social_**Network&prop=revisions&rvprop=**content<http://en.wikipedia.org/w/api.php?format=json&action=query&titles=The_Social_Network&prop=revisions&rvprop=content>
>> >
>> or you can request multiple pages
>>
>> Just save and open in notepad to see the content format in json.
>> Definitely play with the API Sandbox, http://en.wikipedia.org/wiki/**
>> Special:ApiSandbox <http://en.wikipedia.org/wiki/Special:ApiSandbox>
>>
>> You can also request more than one page at time.
>>
>> http://en.wikipedia.org/w/api.**php?action=query&format=xml&**
>> prop=revisions&rvprop=content&**titles=The_Social_Network|**
>> Titanic_(1997_film)<http://en.wikipedia.org/w/api.php?action=query&format=xml&prop=revisions&rvprop=content&titles=The_Social_Network%7CTitanic_%281997_film%29><
>> http://en.wikipedia.org/w/**api.php?action=query&format=**
>> xml&prop=revisions&rvprop=**content&titles=The_Social_**
>> Network%7CTitanic_%281997_**film%29<http://en.wikipedia.org/w/api.php?action=query&format=xml&prop=revisions&rvprop=content&titles=The_Social_Network%7CTitanic_%281997_film%29>
>> >
>>
>> what the API will generate
>> /w/api.php?action=query&prop=**revisions&format=xml&rvprop=**
>> content&titles=The_Social_**Network%7CTitanic_(1997_film) <
>> http://en.wikipedia.org/w/**api.php?action=query&prop=**
>> revisions&format=xml&rvprop=**content&titles=The_Social_**
>> Network%7CTitanic_%281997_**film%29<http://en.wikipedia.org/w/api.php?action=query&prop=revisions&format=xml&rvprop=content&titles=The_Social_Network%7CTitanic_%281997_film%29>
>> >
>>
>> You just need to add in the http://en.wikipedia.org or whatever language
>> sub domain you need like:
>> http://de.wikipedia.org/w/api.**php?action=query&prop=**
>> revisions&format=xml&rvprop=**content&rvlimit=5&titles=The_**
>> Social_Network<http://de.wikipedia.org/w/api.php?action=query&prop=revisions&format=xml&rvprop=content&rvlimit=5&titles=The_Social_Network><
>> http://de.wikipedia.org/w/**api.php?action=query&prop=**
>> revisions&format=xml&rvprop=**content&rvlimit=5&titles=The_**
>> Social_Network<http://de.wikipedia.org/w/api.php?action=query&prop=revisions&format=xml&rvprop=content&rvlimit=5&titles=The_Social_Network>
>> >
>> gives you the German translation.
>>
>> Tips on the API Sandbox is:
>> 1. Format=choose it (format=xml)
>> 2. Action - Set to Query (action=query)
>> 3. Action - Right below, use drop down to choose prop value
>> (prop=revisions).
>> 4. Choose what you want, content (rvprop=content)
>> 5. Loose the revisions to return (rvlimit), clear the input box. I don't
>> know why they set that 10 automatically, let the user decide or else you'll
>> get a snapshot of the last 10 versions of the page.
>> 6. Pick the title, you can get multiple titles by separating them with
>> the pipe | character.
>>
>> The problem you will have to address is parsing out the wiki markup if
>> you just want pure text content. You'll have to find a sanitizer to strip
>> out all the wiki markup.
>>
>> Tom
>>
>>
>>
>> ------------------------------**------------------------------**
>> ------------
>>
>>
>> On 4/27/2012 6:38 AM, Krishna Kranth wrote:
>>
>>> Thanks for the link provided. I tried my best to understand how to
>>> extract data from Wikipedia using APIs. But I failed miserably. Please can
>>> someone help me out to give me a simpler link or example showing the data
>>> from Wikipedia.
>>>
>>> Something like this : http://api.rottentomatoes.com/**
>>> api/public/v1.0/movies.json?**apikey=**e8qkmhd7s4hambanqsbwy9ua&q=**
>>> The+Social+Network<http://api.rottentomatoes.com/api/public/v1.0/movies.json?apikey=e8qkmhd7s4hambanqsbwy9ua&q=The+Social+Network><
>>> http://api.rottentomatoes.**com/api/public/v1.0/movies.**json?apikey=**
>>> e8qkmhd7s4hambanqsbwy9ua&q=**The+Social+Network<http://api.rottentomatoes.com/api/public/v1.0/movies.json?apikey=e8qkmhd7s4hambanqsbwy9ua&q=The+Social+Network>
>>> >
>>>
>>>
>>> Click on the above link and check how simpler it is to get data from
>>> Rotten Tomatoes. Is there any link in that way?
>>>
>>> Thanks in advance.
>>>
>>> Regards
>>> M.Krishna Kranth
>>> Team works means more We less Me.
>>>
>>>
>>> On Thu, Apr 26, 2012 at 6:13 PM, Timothy Helck 
>>> <[email protected]<mailto:
>>> timothy.helck@gmail.**com <[email protected]>>> wrote:
>>>
>>>    Krishna,
>>>
>>>    Try this page: 
>>> http://en.wikipedia.org/w/api.**php<http://en.wikipedia.org/w/api.php>
>>>
>>>    I find some of the other documentation a bit confusing. The above
>>>    link seems to have everything in one place. It takes a while to go
>>>    through it. Once you gain some familiarity with the API you will
>>>    be able to formulate more specific questions, then you will find
>>>    the people on this mailing list to be very helpful.
>>>
>>>    Good luck!
>>>
>>>    Tim Helck
>>>
>>>
>>>
>>>
>>>    On Thu, Apr 26, 2012 at 8:18 AM, Krishna Kranth
>>>    <[email protected] 
>>> <mailto:krishnakranth.m@gmail.**com<[email protected]>>>
>>> wrote:
>>>
>>>        Dear Team,
>>>
>>>        I am planning to start a new website containing celebrities
>>>        from different areas like in sports, movies and politics. For
>>>        this I am planning to exract data from Wikipedia using API in
>>>        XML or JSON format. Can someone send me Wikipedia API and the
>>>        format of response I get? I am pretty much new to this type of
>>>        technical stuff. I tried going through the document but could
>>>        not understand much in detail. An example format will be of
>>>        great use.
>>>
>>>        Thanks in advance.
>>>
>>>        Regards
>>>        M.Krishna Kranth
>>>        Team works means more We less Me.
>>>
>>>        ______________________________**_________________
>>>        Mediawiki-api mailing list
>>>        
>>> [email protected].**org<[email protected]>
>>>        
>>> <mailto:Mediawiki-api@lists.**wikimedia.org<[email protected]>
>>> >
>>>
>>>        
>>> https://lists.wikimedia.org/**mailman/listinfo/mediawiki-api<https://lists.wikimedia.org/mailman/listinfo/mediawiki-api>
>>>
>>>
>>>
>>>    ______________________________**_________________
>>>    Mediawiki-api mailing list
>>>    [email protected].**org<[email protected]>
>>>    
>>> <mailto:Mediawiki-api@lists.**wikimedia.org<[email protected]>
>>> >
>>>
>>>    
>>> https://lists.wikimedia.org/**mailman/listinfo/mediawiki-api<https://lists.wikimedia.org/mailman/listinfo/mediawiki-api>
>>>
>>>
>>>
>>>
>>> ______________________________**_________________
>>> Mediawiki-api mailing list
>>> [email protected].**org <[email protected]>
>>> https://lists.wikimedia.org/**mailman/listinfo/mediawiki-api<https://lists.wikimedia.org/mailman/listinfo/mediawiki-api>
>>>
>>
>> ______________________________**_________________
>> Mediawiki-api mailing list
>> [email protected].**org <[email protected]>
>> https://lists.wikimedia.org/**mailman/listinfo/mediawiki-api<https://lists.wikimedia.org/mailman/listinfo/mediawiki-api>
>>
>
>
> _______________________________________________
> Mediawiki-api mailing list
> [email protected]
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
>
>
_______________________________________________
Mediawiki-api mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api

Reply via email to