Updated URL handler to check content-type and improved title matching regex