Pywikipedia

We looking for new a maintainer for AndyZ's peerreviewer script, see WT:Peer review for details.
WPW (web pywikipedia) framework is a minimal reimplementation of pywikipedia. It is designed to load fast with a smaller memory footprint with as few libraries as possible. Despite its incompleteness I preferable it for testing as it eliminates the 5 second initialization delay of pywikipedia.

Programs

The programs below have been port as to test of frameworks capability. Only a few changes are necessary to deal HTML limitations and lack of interactivity. Programs run in a similar manner to their command line counterparts. If the program is significantly changed or enhanced from its command line counterpart it is prefixed with “web” in front.

./? -page:

Most the scripts use pagegenerators.py library allow for multiple page arguments such as from sources: backlinks, categories, Title prefixing, and external link.

commonfixes.py

Applies link, HTML, and template fixes similar to AWB's General fixes, only enabled the Englished Wikipedia. Used by webchecklinks, webreflinks, and PDFbot to standardize wikisyntax. Bookmarklet: commonfixes

cosmetic_changes.py

Does slight modifications to the wikitext so the code looks cleaner. The changes are not supposed to change the look of the rendered wiki page.

This script is not fully ported yet, featured related to internal, category, and language links are not implemented in wikipedia.py yet. Additionally some specific features for safe replacement are not implemented correctly. Use at your own risk.

noreferences.py

Adds a <references /> to the References section if missing and <ref> exists; if the section does not exists it intelligently adds it.

pdfbot.py

Add file sizes to external link wrapped with the formatting template {{PDFlink}}. Source code

reflinks.py

Fills in the title for bare reference links in the form of <ref>http://en.wikipedia.org/</ref> and converts into <ref>[http://en.wikipedia.org/ Wikipedia, the free encyclopedia<!-- bot generated title -->]</ref> using the title from an HTML page or PDF. DumZiBoT run this script to add titles to many references and the script writing the bot owner and writing has posted some of the frequently asked question about his script.

standardize_notes.py

Update and fixes reference using the footnotes system. Developed by User:SEWilco.

NOTE: This script is not capable of handling the <ref></ref> syntax. It just handles the {{ref}} syntax, which is still used, but is DEPRECATED on the English Wikipedia.

table2wiki.py

Convert many HTML-tables into MediaWiki tables (wikitables).

Examples: [http://en.wikipedia.org/w/index.php?title=Crimpshrine&diff=249538891&oldid=prev], [http://en.wikipedia.org/w/index.php?title=List_of_people_on_stamps_of_Ireland&diff=next&oldid=240474304]

Features

  • Quick porting between command line and web application
  • Fast startup times (< 1 sec)
  • Limited Multi-language (excluded localized namespaces)
  • MediaWiki like human and machine interfaces

General query parameters

Language support

Support for languages is accomplish is typically by giving the programs the page title in interwiki format. For example the German Wiktionary page for “Fenster” would be inputted as wikt:de:Fenster. This is cumbersome so an easier way is to paste the URL and it will automagically convert to the correct form. Some program are not properly built and so require the use of the &family= and &lang= to setup the project and language, respectively.

Edit token

If the string &wpEditToken= is supplied with a valid edit token for your account the save button will be enabled. This can be used in conjuction with the parameter &autoclick= to autosave pages.

Porting

  1. Add to top of the script #!/usr/bin/python2.5
  2. Change the permissions to -rwxr-xr-w
  3. Change the initializing code from
if __name__ == "__main__":
	try:
		main()
	finally:
		wikipedia.stop()
to
if __name__ == "__main__" and wikipedia.handleUrlAndHeader():
	try:
		wikipedia.startContent()
		main()
	finally:
		wikipedia.endContent()
		wikipedia.stopme()
Interaction