Help:Export Helper Script

From Meta, a Wikimedia project coordination wiki
Jump to navigation Jump to search

This page describes to the use of a simple Python script to assist the average Linux/OSX/Windows user in performing mass-exports from established Wikis. Typical use would be exporting the Help: pages from meta.wikimedia.org and importing them to an internal mediawiki installation.

Quick Steps[edit]

  1. Go to Special:Allpages and choose the desired namespace.
  2. Save the entire webpage as index.php.htm
  3. Run export_all_helper.py in the same directory as index.php.htm
  4. Copy and paste the scripts output into Special:Export and save the resulting XML output as Special_Export.xml
  5. Open your personal/internal mediawiki and login as the administrator
  6. Go to Special:Import (your wiki) and import Special_Export.xml

export_all_helper.py[edit]

#!/bin/env python
import re
content = open('index.php.htm').read()
findSpecialPages = re.compile('title="(\w.*?)"').findall
print '\n'.join(findSpecialPages(content))