text = bs4. BeautifulSoup(page). getText(separator=” “) # Limit the content to the first 150 bytes, eliminate leading or # trailing whitespace. snippet = text[0:150] # If text was longer than this (most likely), also add ‘…’ if len(text) > 150: snippet += “…”