You can specify clshow=!hidden to omit the "hidden" categories that, by default, are not shown at the bottom of a page:

http://en.wikipedia.org/w/api.php?action=query&prop=categories&titles=Broccoli&clshow=!hidden

-Ran



On Wed, Jul 3, 2013 at 11:07 PM, Chux <chux18@gmail.com> wrote:
Hi guys,

When I do a query for categories using the API I would only like to get the categories that are listed in the wiki page. For example when I query the Brocoli page, I get this:

<categories>
<cl ns="14" title="Category:All articles with unsourced statements"/>
<cl ns="14" title="Category:Articles containing Italian-language text"/>
<cl ns="14" title="Category:Articles with 'species' microformats"/>
<cl ns="14" title="Category:Articles with unsourced statements from January 2013"/>
<cl ns="14" title="Category:Brassica oleracea"/>
<cl ns="14" title="Category:Commons category with local link same as on Wikidata"/>
<cl ns="14" title="Category:Cultivars"/>
<cl ns="14" title="Category:Edible plants"/>
<cl ns="14" title="Category:Inflorescence vegetables"/>
<cl ns="14" title="Category:Pages with citations having bare URLs"/>
</categories>

But I am only interested in these (You'll see it at the bottom of this page http://en.wikipedia.org/wiki/Brocoli):

<cl ns="14" title="Category:Brassica oleracea"/>
<cl ns="14" title="Category:Cultivars"/>
<cl ns="14" title="Category:Edible plants"/>
<cl ns="14" title="Category:Inflorescence vegetables"/>

I was wondering if there is any workaround this?

Thanks
Chux


_______________________________________________
Mediawiki-api mailing list
Mediawiki-api@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api