I am making a dictionary that looks up the word in Spanish and gives me its corresponding English translation. I am quite new to BeautifulSoup, so I am taking advantage of this opportunity to learn web scraping.
The webpage link is https://www.spanishdict.com/translate/rojo. I just typed 'rojo' for an example.
However, after I successfully extracted the translation, I would like to extract some example sentences as well, but here I encounter one problem. I cannot extract one of the sentences inside the <span> WITHOUT class name.
I tried
soup.find_all(name='div', class_='indent--FyTYr')
But many unnecessary information within that class popped up.
I also noticed one answer from the post the link mentioned previous_sibling, but it didn't work.
The sample html code will look like:
<div class="indent--FyTYr">
<div>
<span>The sky turned red at sundown.</span>
<span class="dash--SIa20"></span>
<em class="exampleDesktop--3n1hN">El cielo se tornó rojo al atardecer.</em>
</div>
...
</div>
I would like to extract the sentence from the above html sample code. But I haven't found any useful method to locate and extract.
The sky turned red at sundown.
