lang='nl'
import pickle
import re
cache=pickle.load(file("featured/cache","rb"))
data = {}
for fromlanguage in cache:
d = cache[fromlanguage][lang]
for page in d.values():
if page not in data:
data.update({page: set([])})
data[page].add(fromlanguage)
for page in data:
p = wikipedia.Page(wikipedia.getSite(lang), page)
t = p.get()
re.sub('{{Link FA\|[a-zA-Z]*}}[\r\n]*', '', t)
links = ""
for lang in data[page]:
links += "{{Link FA|" + lang + "}}"
text=wikipedia.replaceCategoryLinks(t + links, p.categories())
comment = wikipedia.setAction("Featured article links for %r" % data[page])
p.put(text, comment)