I constructed a small parser in Python which extracts different quotations from MotivatingQuotes.com (not too much for a start, take it as of Python learning course and general practice). I’m going to use these quotations in the next small utility, so stay tuned.
Parser is able to extract quotations from pre-fetched html pages (use wget or any other similar tool) and store them in output file in CSV format (Category, Quote, Author). Fancy details like color highlight for console output, automatic encoding detection and command line options are included.
Source code is generic enough to adopt it for any format with little help of regex tweaking.
Usage: motivatingquotes.py [options] [-h]
Options:
-h, --help show this help message and exit
-q, --quiet Quiet mode
-f WILDCARD, --from=WILDCARD
Files to extract quotes information from, e.g "*.html"
-o FILE, --out=FILE Save extracted qutoes to file in CSV format, e.g
"quotes.csv"
Downloads for this app
- resulting .zip with ~2500 extracted quotations for your convenience.
- motivatingquotes.com parser source (.zip)
Tags: python