Skip to content

Instantly share code, notes, and snippets.

@fnneves
Created September 27, 2020 17:17
Show Gist options
  • Save fnneves/7b1c9d75beaf86f985cc3fff1ad5acbb to your computer and use it in GitHub Desktop.
Save fnneves/7b1c9d75beaf86f985cc3fff1ad5acbb to your computer and use it in GitHub Desktop.
import bs4
html = """<html>
<div class="some_class">
some random text to be scraped
</div>
</html>"""
parsed_html = bs4.BeautifulSoup(html, "html.parser")
text_scraped = parsed_html.find("div",attrs={"class":"some_class"}).text
print(text_scraped)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment