Wait, aren't you using Pywikipediabot's weblinkchecker.py? Where is that code snippet from?
Oh, that exists. Well I kind of reinvented the wheel a bit.