<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.wesnoth.org/index.php?action=history&amp;feed=atom&amp;title=User%3AGrabberBot%2Fupdate_counts.py</id>
	<title>User:GrabberBot/update counts.py - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.wesnoth.org/index.php?action=history&amp;feed=atom&amp;title=User%3AGrabberBot%2Fupdate_counts.py"/>
	<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=User:GrabberBot/update_counts.py&amp;action=history"/>
	<updated>2026-04-22T11:12:07Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.31.16</generator>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=User:GrabberBot/update_counts.py&amp;diff=7421&amp;oldid=prev</id>
		<title>Allefant: new script for grabberbot to update contributor stats</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=User:GrabberBot/update_counts.py&amp;diff=7421&amp;oldid=prev"/>
		<updated>2006-02-18T18:31:10Z</updated>

		<summary type="html">&lt;p&gt;new script for grabberbot to update contributor stats&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
import re, urlgrabber.grabber, sys&lt;br /&gt;
import mediawiki&lt;br /&gt;
&lt;br /&gt;
mw = mediawiki.MediaWiki()&lt;br /&gt;
&lt;br /&gt;
allpages = urlgrabber.grabber.urlread(&amp;quot;http://www.wesnoth.org/wiki/Special:Allpages&amp;amp;namespace=102&amp;quot;)&lt;br /&gt;
allpages = re.compile('title=&amp;quot;(.*?)&amp;quot;').findall(allpages)&lt;br /&gt;
counts = {}&lt;br /&gt;
&lt;br /&gt;
allpages.remove(&amp;quot;Special:Allpages&amp;quot;)&lt;br /&gt;
print allpages&lt;br /&gt;
for page in allpages:&lt;br /&gt;
    print page,&lt;br /&gt;
    c = mw.fetch(page)&lt;br /&gt;
    count = 0&lt;br /&gt;
    if c:&lt;br /&gt;
        for line in c.splitlines():&lt;br /&gt;
            if re.compile(&amp;quot;.*?://.*?\\.(gif|jpg|png|bmp|tga|jpeg)&amp;quot;, re.I).match(line):&lt;br /&gt;
                count += 1&lt;br /&gt;
    counts[page] = count&lt;br /&gt;
    print count&lt;br /&gt;
&lt;br /&gt;
allpages.sort()&lt;br /&gt;
newlist = [&amp;quot;* [[%s]] (%d)&amp;quot; % (x, counts[x]) for x in allpages]&lt;br /&gt;
newlist = &amp;quot;\n&amp;quot;.join(newlist)&lt;br /&gt;
newlist = &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
== Contributors ==&lt;br /&gt;
&lt;br /&gt;
%s&lt;br /&gt;
&lt;br /&gt;
== See Also ==&amp;quot;&amp;quot;&amp;quot; % newlist&lt;br /&gt;
&lt;br /&gt;
glib = mw.fetch(&amp;quot;GraphicLibrary&amp;quot;)&lt;br /&gt;
if glib and glib != newlist:&lt;br /&gt;
    glib = re.compile(r&amp;quot;\n== Contributors ==\s*(.*?)\s*\n== See Also ==&amp;quot;, re.S).sub(newlist, glib)&lt;br /&gt;
    mw.post(&amp;quot;GraphicLibrary&amp;quot;, glib, &amp;quot;automated update of contributor stats&amp;quot;)&lt;br /&gt;
    print &amp;quot;Successfully updated GraphicLibrary counts!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Allefant</name></author>
		
	</entry>
</feed>