Create fortune(6) files from Wikiquote

Create fortune(6) files from Wikiquote

Yesterday I was searching for some modern fortune(6) files because I'm really bored by the existing collections that are mostly from the '90s. So after finding the Splitbrain collection of fortunes which includes quotes from "The X-Files" I've decided to roll my own solution: a simple Python script that fetch a Wikiquote_ page and extracts the quotes to create a fortune(6) file.

You can find the script on github.

Example usage; we fetch quotes for Lost and store them in ~/.fortunes:

$ wikiquote2fortune -u '' \
-O lost -n Lost
$ strfile lost
$ mkdir ~/.fortunes
$ mv lost* ~/.fortunes

You can test the installation running:

$ fortune ~/.fortunes
Dr. Brooks: Dave isn't your friend, Hugo. Because Dave doesn't exist.

    "Lost: Dave [2.18], Season Two"

It will probably have bugs since I've written it in a hurry ;)