def get_first_text(soup, strip = False, types = (NavigableString, CData)): data = None for s in soup._all_strings(strip, types = types): data = s break return data