improve doctests and refactor title extraction
allow multiple hosts, e.g. HTTP and HTTPS sites