Menu

Site info like {{NUMBEROFPAGES}}

Help
2015-01-13
2015-01-27
  • Juergen Thomas

    Juergen Thomas - 2015-01-13

    Is there a simple way to get informations about the site instance, especially Statistics like {{NUMBEROFPAGES}}, {{NUMBEROFARTICLES}}, and so an (listed in the magic words)? Juergen

     
  • CodeDriller

    CodeDriller - 2015-01-24

    There are some special pages:

    Special:Statistics
    Special:MediaStatistics

    But you'll have to parse them manually.

     
  • Juergen Thomas

    Juergen Thomas - 2015-01-27

    Thank you for the hint. It works with Special:Statistics in de-Wikibooks. Unfortunately, Page.Load gives the full html source (as well as Site.GetWebPage). The numbers are contained in a with several using class attributes. Parsing is possible, but I'm not sure if I want to do so... Juergen

    For users who want to do this: the structure of the page (simplified) showing the number of articles:

    <body>
      <div id="content">
        <div id="bodyContent">
          <div id="mw-content-text">
            <table class="wikitable mw-statistics-table">
              <tr class="mw-statistics-articles">
                <td>description column</td>
                <td class="mw-statistics-numbers">23.009</td>
              </tr>
    
     
  • CodeDriller

    CodeDriller - 2015-01-27

    Well, alternatively you can create a page like "User:Me/Stats" with contents like this:

    NUMBEROFPAGES={{NUMBEROFPAGES}}
    NUMBEROFARTICLES={{NUMBEROFARTICLES}}

    It can be parsed much easier, e.g.:

    string pagesNum = Regex.Match(Site.GetWebPage(...), "NUMBEROFPAGES=(\d+)").Groups[1].Value;

     
  • Juergen Thomas

    Juergen Thomas - 2015-01-27

    Indeed. Many users show such informations on their user page. Juergen

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.