Wikipush Toolkit

From semantic-mediawiki.org
SMWCon Fall 2020
Wikipush Toolkit
Talk details
Description: wikipush,wikiedit,wikiupload,wikinuke,wikiuser a set of tools for automating SMW page content handling using python and a command line
Speaker(s): Wolfgang Fahl
Type: Tutorial
Audience: Community
Event start: 2020/11/25 18:00:00
Event finish: 2020/11/25 18:30:00
Length: 25 minutes
Video: not available
Keywords: Python, Automation
Give feedback

Examples[edit]

Wikipush[edit]

wikipush -s smw -t test2 -q "[[Category:City]]|limit=5"
family and mylang are not set.
Defaulting to family='test' and mylang='test'.
copying 4 pages from smw to test2
copying Demo:Tokyo ...✅
copying image File:SMW-Info-button.png ...✅
copying image File:Tokyo-Tsukishima-0011.jpg ...✅
copying Vienna ...✅
copying Warsaw ...✅
copying image File:6140285934 02e81b845f z.jpg ...✅
copying Demo:Würzburg ...✅

Wikiupload[edit]

wikiupload -t test --files car.png
uploading 1 files to test
1/1 ( 100%): uploading car.png ...✅

Wikinuke[edit]

The default behavior is a dry run only listing whether the pages exist

wikinuke -t test -p deleteMe1 deleteMe2 deleteMe3
deleting 3 pages in test (dry run)
1/3 (  33%): deleting deleteMe1 ...👍
2/3 (  67%): deleting deleteMe2 ...👍
3/3 ( 100%): deleting deleteMe3 ...👍

After checking you might want to (carefully) use the "-f" option to actually force the deletion:

wikinuke -t test -p deleteMe1 deleteMe2 deleteMe3 -f
deleting 3 pages in test (forced)
1/3 (  33%): deleting deleteMe1 ...✅
2/3 (  67%): deleting deleteMe2 ...✅
3/3 ( 100%): deleting deleteMe3 ...✅

Wikiedit[edit]

wikiedit -t test -q "[[isA::CFP]]"  --search "CALL FOR PAPER" --replace "CFP"
editing 1 pages in test (dry run)
1/1 ( 100%): editing CALL FOR PAPER Journal: Advances in Multimedia - An International Journal (AMIJ) ...👍 |isA=CFP
-|Acronym=CALL FOR PAPER Journal: Advances in Multimedia - An International Journal (AMIJ) 
-|Title=CALL FOR PAPER Journal: Advances in Multimedia - An International Journal (AMIJ) 
+|Acronym=CFP Journal: Advances in Multimedia - An International Journal (AMIJ) 
+|Title=CFP Journal: Advances in Multimedia - An International Journal (AMIJ) 
 |Start date=2010/11/01
 }}
-CALL FOR PAPER
+CFP
 Journal: Advances in Multimedia - An International Journal (AMIJ)

E.g. if you have an account on www.semantic-mediawiki.org you can start wikiuser in interactive mode.

Wikiuser[edit]

wikiuser
email: john@doe.com
scriptPath: /w
user: jd
url: http://www.semantic-mediawiki.org
version: Mediawiki 1.33
wikiId: smw
password: *****
shall i store jd smw? yes/no y/ny

Now you can e.g. use "smw" as the wikiid for this wiki when using wikipush

Links[edit]