7

How can I get the total number of articles using the MediaWiki API?

I couldn't find it in the docs:

Even a rough approximation is fine.

Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92
Mulone
  • 3,603
  • 9
  • 47
  • 69

1 Answers1

9

Use the link http://en.wikipedia.org/w/api.php?action=query&meta=siteinfo&siprop=statistics and read the property articles of the statistics tag.

celtschk
  • 19,311
  • 3
  • 39
  • 64
  • 1
    what's the difference between pages and articles? I thought it was basically the same thing! – Mulone Nov 08 '11 at 14:17
  • 3
    pages also counts things like user pages and project pages, while articles only counts pages in the article (i.e. main) namespace. – celtschk Nov 08 '11 at 14:27
  • Also, very short articles tend to be counted as pages. (I think the exact rule is that it must be in main namespace, contain an internal link and not be a redirect to be counted as an articel.) – Tgr Nov 09 '11 at 20:43
  • 2
    To clear the somewhat implied separation, **articles is a subset of pages**. Any article is also a page, but many kinds of pages (as celtschk pointed out) are not considered articles. – Timo Tijhof Dec 02 '11 at 11:26