문제

I am using wikimedia api and I need to get a parent category of category (e.g 'Mammals by common name' is parent category for category 'dogs'. But still I can't find out good solution. I was thinging abouth sth like

http://en.wikipedia.org/w/api.php?action=query&titles=dogs&prop=categories&clcategories=Category:Mammals%20by%20common%20name

but dogs is category not page so the output is like if 'Mammals by common name' wasnt parent category.

도움이 되었습니까?

해결책

Your query checks whether the article Dogs (which is actually a redirect to Dog) belongs to Category:Mammals by common name, which it doesn't. If you want to check the category Dogs, you need to specify that:

http://en.wikipedia.org/w/api.php?action=query&titles=Category:Dogs&prop=categories&clcategories=Category:Mammals%20by%20common%20name

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top