Posts

Parse HTML Code With Beautiful Soup

Beautiful Soup   is a Python library for   parsing structured data . It allows you to interact with HTML in a similar way to how you would interact with a web page using developer tools. Beautiful Soup exposes a couple of intuitive functions you can use to explore the HTML you received. To get started, use your terminal to install the Beautiful Soup library: $ pip3 install beautifulsoup4 Then, import the library and create a Beautiful Soup object: import requests from bs4 import BeautifulSoup URL = 'https://www.monster.com/jobs/search/?q=Software-Developer&where=Australia' page = requests . get ( URL ) soup = BeautifulSoup ( page . content , 'html.parser' ) When you add the two highlighted lines of code, you’re creating a Beautiful Soup object that takes the HTML content you scraped earlier as its input. When you instantiate the object, you also instruct Beautiful Soup to use the appropriate parser. Find Elements by ID In an HTML w...