Codementor Events

Beautiful Soup

Published Feb 18, 2018
Beautiful Soup

Web scraping is soup-er fun with Beautiful Soup!!!

In Python, there is a library called Beautiful Soup that parses HTML.

For instance, if you wanted to scrap the description element from a Youtube page, you could use the following snippet:

import requests
from bs4 import BeautifulSoup

url = "https://www.youtube.com/watch?v=fHbCfx9ljn8"
page = requests.get(url)
soup = BeautifulSoup(page.content, 'html.parser')
desc = soup.find('p',id='eow-description')
print(desc)
Discover and read more posts from Jessica Owensby
get started
post commentsBe the first to share your opinion
Show more replies