I'm scraping an HTML document using BeautifulSoup4. But I was obliged to obtain Text commented. If I want to get commented text like this:
<!-- este es el texto -->
That can be obtained (bypassing the other statements) like this:
texto = soup.find_all(string = lambda text:isinstance(text,Comment))
But I want to get the text inside a tag commented like this:
<!-- <span>texto que quiero</span> -->
Is there any way that can be done? The python code that I put returns an object from the bs4 library, not a string, so I do not know how to convert it to string and do a replace, this as a last resort, since I would like to do almost everything using the functionalities of bs4