QOTD - Quote Of The Day

Simple python command-line script to display quote of the day in your terminal.


~/bin/qotd

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/local/bin/python
from pyquery import PyQuery as pq
from sys import argv
from subprocess import check_call

home = pq(url='http://www.brainyquote.com/quotes_of_the_day.html')

node = home('.bqPhotoDefault:first')

if '-i' in argv:
src = 'http://www.brainyquote.com' + node.attr('src')
check_call('curl -q "%s" 2>/dev/null | imgcat' % src, shell=True)
else:
print node.attr('alt').strip()

> qotd

For success, attitude is equally as important as ability. - Walter Scott


> qotd -i

qotd{: .center-image }


This script can be further extended to: create a wallpaper for the quote with a hd background or a gradient, set the image as wallpaper, etc.

It can also be written without PyQuery external dependency.