import requests
from bs4 import BeautifulSoup
#url = 'https://www.goodreads.com/quotes'
#r = requests.get(url)
#soup = BeautifulSoup(r.content, 'html.parser')
html = """
<div class="quoteText">“Insanity is doing the same thing, over and over again, but expecting different results.” <br> ―
<span class="authorOrTitle">Narcotics Anonymous</span>
</div>
"""
soup = BeautifulSoup(html, 'html.parser')
quotes = soup.find_all('div', {'class': 'quoteText'})
for quote in quotes:
if quote.text is not None:
quote_ = quote.text
quote_data = quote_.split(" ―")
quote_without_author = quote_data[0]
quote_author = quote_data[1]
print(quote_without_author.strip())
print(quote_author.strip())
Вы можете разделить данные на -, как и элемент [0] вашей цитаты и [1] вашего автора.
Выход:
“Insanity is doing the same thing, over and over again, but expecting different results.”
Narcotics Anonymous