Currently I'm scraping a news site for a research work here I used python+BeautifulSoup as follows
newsPageSoup = BeautifulSoup(newsPage.content, 'html.parser', from_encoding="iso 639-3")
newsText = newsPageSoup.find(class_='post-content').get_text()
to obtain the text part from the following html code. It worked fine.
<p class="post-content">The completion of the sixth review, upon the granting of a waiver of non‑observance for the end‑June 2019, performance criterion on the primary balance</p>
But the case is I want to extract the text part Andrew from following
<p class="text-primary" style="color : #2793ed; font:Arial, Helvetica, sans-serif; font-size:14px; font-weight:normal">Andrew <small style="color:#999999; font-size:11px">Friday, 13 December 2019 07:58 PM </small> </p>
So I used the python code same as above
readerNames = newsPageSoup.find(class_='text-primary').get_text()
but it gives the following error
AttributeError: 'NoneType' object has no attribute 'get_text'
I think it is because of the <small>
tag inside the <p>
tag.So Is their a way to do that? Please help