Skip to content

Instantly share code, notes, and snippets.

@beachandbytes
Created January 31, 2014 23:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beachandbytes/8745632 to your computer and use it in GitHub Desktop.
Save beachandbytes/8745632 to your computer and use it in GitHub Desktop.
from bs4 import BeautifulSoup, SoupStrainer
import httplib2
import random
print random.choice([link.getText().replace("//","").strip().encode('utf-8') for link in BeautifulSoup(httplib2.Http().request('http://www.velominati.com/the-rules/')[1]).findAll("div", { "class" : "rule" })])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment