Skip to content

Instantly share code, notes, and snippets.

rc_title rc_cur_id rc_this_oldid topic
Josef_Augusta_(politik) 1731875 20821697 ['europe', 'biography']
Karel_Stejskal 1731877 20821971 ['europe', 'biography']
17._protiletadlová_baterie_Klement_Gottwald 1731878 20821994 ['military-and-warfare', 'europe', 'politics-and-government']
Mary_Carnellová 1731888 20822291 ['history', 'biography', 'women', 'north-america']
Jan_Anderle_(hudebník) 1731901 20822575 ['europe', 'biography']
Natacha_Régnierová 1731902 20822582 ['europe', 'biography', 'women']
Adam_Goljan 1731906 20822646 ['europe', 'sports', 'biography']
Gerygone 1731907 20822657 ['oceania', 'general-science', 'biology', 'politics-and-government']
Gentská_univerzita 1731908 20822673 ['education', 'europe']
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import requests
import mwparserfromhell
import toolforge
import sys
conn = toolforge.connect(sys.argv[1]) # cswiki
API_URL = sys.argv[2] # https://cs.wikipedia.org/w/api.php
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import requests
import mwparserfromhell
import toolforge
import sys
conn = toolforge.connect(sys.argv[1]) # cswiki
API_URL = sys.argv[2] # https://cs.wikipedia.org/w/api.php
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import pywikibot
import json
CLAIMS = ['Q41197-3527CCB4-A422-4B31-AED4-BB2CCBF07790']
NEW_RANK = 'deprecated'
SUMMARY = 'Deprecating %s' # %s will be replaced with claim ID

This is script for dumping data from old Extension:EducationProgram to wiki, because only SQL dumps were provided (https://dumps.wikimedia.org/other/educationprogram/).

The requirement for running this script is to have: a) ToolForge access b) some templates (with syntax equivalent to the one Outreach Dashboard currently uses, so if you do have editing from the Dasbhaord enabled, you should have the templates); if you don't have such templates, adapt those from cs.wikipedia. If you want to, you can adapt the script to not require a) or b).

Before running, you must firstly adapt the script for your wiki. This means the following:

  1. Adapt line 7 and line 8 to create correct DB connection and site connection
  2. Adapt line 25, line 40, line 53 and line 54 to your template names.
  3. Adapt summary on line 55

After you have customized the script, you can do the following:

@urbanecm
urbanecm / addReferences.sh
Created January 7, 2017 13:54
Add references
python ~/pwb/scripts/replace.py -regex "==(=*) *Literatura *==(=*)" "==\1 Reference ==\2\n<references />\n\n\0" -excepttext:"Reference" -summary:'Robot: Přidání sekce reference' -start:!
python ~/pwb/scripts/replace.py -regex "==(=*) *Související články *==(=*)" "==\1 Reference ==\2\n<references />\n\n\0" -excepttext:"Reference" -summary:'Robot: Přidání sekce reference' -start:!
python ~/pwb/scripts/replace.py -regex "==(=*) *Související stránky *==(=*)" "==\1 Reference ==\2\n<references />\n\n\0" -excepttext:"Reference" -summary:'Robot: Přidání sekce reference' -start:!
python ~/pwb/scripts/replace.py -regex "==(=*) *Externí odkazy *==(=*)" "==\1 Reference ==\2\n<references />\n\n\0" -excepttext:"Reference" -summary:'Robot: Přidání sekce reference' -start:!
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import pywikibot
import time
import sys
import re
import logging