One way to do it is to export the article history, and then process the revisions using a local tool like git blame
. This could be done using a script.
To export the article history, use Special:Export
, specifically: https://en.wikipedia.org/w/index.php?title=Special:Export&history=1&action=submit&pages=Blinkenlights
.
To generate the blame, first add the revisions to a temporary git repository (shown in Python 3):
import tempfile
import subprocess
with tempfile.TemporaryDirectory() as repo:
os.chdir(repo.name)
subprocess.check_call(['git', 'init'])
Then download the exported history XML, parse it with something like lxml.etree
, and loop over the revisions (xpath //revision
). For each revision, write the text to a file (say article.wiki
), read the author, and run
subprocess.check_call(['git', 'commit', '-a', '-m', 'blah', '--author=' + str(author)])
After all revisions are added to the repo, run git blame article.wiki
to see the author of each line.
Note: Special:Export
might restrict the number of revisions exported, so in pages with long history you might have to fetch the XML multiple times.