4

使用 mediawiki API,我可以列出给定类别中的页面。例如:

http://en.wikipedia.org/w/api.php?action=query&list=categorymembers&cmtitle=Category:Physics

返回:

<?xml version="1.0"?>
<api>
  <query>
    <categorymembers>
      <cm pageid="22939" ns="0" title="Physics" />
      <cm pageid="24489" ns="0" title="Outline of physics" />
      <cm pageid="1653925" ns="100" title="Portal:Physics" />
      <cm pageid="3445246" ns="0" title="Glossary of classical physics" />
      <cm pageid="22950086" ns="0" title="Britney Spears&#039; Guide to Semiconductor Physics" />
      <cm pageid="2129107" ns="14" title="Category:Fundamental physics concepts" />
      <cm pageid="4769321" ns="0" title="Timeline of fundamental physics discoveries" />
      <cm pageid="694942" ns="14" title="Category:Physicists" />
      <cm pageid="1198" ns="0" title="Acoustics" />
      <cm pageid="1913676" ns="14" title="Category:Applied and interdisciplinary physics" />
    </categorymembers>
  </query>
  <query-continue>
    <categorymembers cmcontinue="Atomic, molecular, and optical physics|" />
  </query-continue>
</api>

我现在想将我的查询限制在一个 MW 命名空间。我尝试使用cmnamespace参数。但

http://en.wikipedia.org/w/api.php?action=query&list=categorymembers&cmtitle=Category:Physics&cmnamespace=0

返回相同的结果。我应该如何使用这个命名空间参数?

4

1 回答 1

4

看起来像是在英语维基百科上运行的代码中的一个错误 - 你的语法在稍微旧版本的 MediaWiki 上对我来说很好。

于 2009-07-15T15:46:16.660 回答