Hi Masti, Thank you for the reply. As I see and searched in the API, there is no way that I can get the template extraction through the API. So what I am thinking is to get the list of templates through API as follows for Amoxicillin.
http://en.wikipedia.org/w/api.php?action=query&prop=templates&titles=Amoxicillin But I do not see the template "Template:Cell_wall_disruptive_antibiotics" as you mentioned in the last e-mail. I expected prop=templates query would give me all the properties in the wiki page. Then select the appropriate template to get external links using API as follows. http://en.wikipedia.org/w/api.php?action=query&prop=links&titles=Template:Cell_wall_disruptive_antibiotics&format=json&pllimit=500 I also have issues with this query as well. It returns links that I do not see in the template page. For example, Beta-lactam antibiotic is not there in the template page but the query return it. Do you have any idea about these issues? Thank you. ________________________________________ From: mediawiki-api-boun...@lists.wikimedia.org [mediawiki-api-boun...@lists.wikimedia.org] on behalf of masti [mast...@gmail.com] Sent: Thursday, September 13, 2012 7:38 AM To: mediawiki-api@lists.wikimedia.org Subject: Re: [Mediawiki-api] extracting external link portion of a wiki page The table you are referring to is a template. In this case http://en.wikipedia.org/wiki/Template:Cell_wall_disruptive_antibiotics so you need to extract links from this template page. They are not directly stated in the article. masti On 09/13/2012 04:37 AM, Gunaratna, Dalkandura Arachchige Kalpa Shashika Silva wrote: > Hi Ed, > The query you mentioned returns external urls in the web page. May be > the word I used is ambiguous. In some Wikipedia pages there is a section > called "External Links". It is normally after further reading section. so in > this example Amoxicillin Wikipedia page, there is a table like structure > having a heading "Antibacterials: cell envelope antibiotics (J01C-J01D)" > under "External Link" section of the page. Basically, what I want to do is to > get urls mentioned in that section for each wikipedia page. Do you get the > requirement clearly now? Thank you. > > regards, > Kalpa > ________________________________________ > From: mediawiki-api-boun...@lists.wikimedia.org > [mediawiki-api-boun...@lists.wikimedia.org] on behalf of Ed Summers > [e...@pobox.com] > Sent: Wednesday, September 12, 2012 10:27 PM > To: MediaWiki API announcements& discussion > Subject: Re: [Mediawiki-api] extracting external link portion of a wiki page > > Does, this get you what you need? > > > http://en.wikipedia.org/w/api.php?action=query&prop=links&titles=Amoxicillin&format=json&pllimit=500 > > It should return all the Wikipedia links in the article. The external > links are links to web properties outside of Wikipedia. > > //Ed > > On Wed, Sep 12, 2012 at 10:12 PM, Gunaratna, Dalkandura Arachchige > Kalpa Shashika Silva<gunaratn...@wright.edu> wrote: >> Hi, >> I have been using mediaWiki API to get categories a page belongs to using >> 'query' for 'action' and 'category' for 'prop'. >> >> Now I want to get external link part of a page. For example, Amoxicillin >> wikipedia page http://en.wikipedia.org/wiki/Amoxicillin has a table like >> structure in the external links section down in the bottom of the page >> having links to many other related concepts to Amoxicillin. I want to >> retrieve links of those related concepts. Currently, I am looking for a way >> to get these details. I am not sure yet whether I can do it through the API >> or I just have to process the page to get those details. If there is a way >> to get these details through MediaWiki API, please respond. Thank you very >> much in advance. >> >> regards, >> Kalpa >> >> _______________________________________________ >> Mediawiki-api mailing list >> Mediawiki-api@lists.wikimedia.org >> https://lists.wikimedia.org/mailman/listinfo/mediawiki-api >> > > _______________________________________________ > Mediawiki-api mailing list > Mediawiki-api@lists.wikimedia.org > https://lists.wikimedia.org/mailman/listinfo/mediawiki-api > > > > _______________________________________________ > Mediawiki-api mailing list > Mediawiki-api@lists.wikimedia.org > https://lists.wikimedia.org/mailman/listinfo/mediawiki-api _______________________________________________ Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api _______________________________________________ Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api