The beautifulsoup library

beautifulsoup is a library in Python, used for web scraping. It has simple methods for searching, navigating, and modifying. It is simply a toolkit used for extracting the data you needed from a web page.

Now, to use the requests and beautifulsoup functionality in your scripts you must import these two libraries using the import statement. Now, we are going to see an example of parsing a web page. Here, we are going to parse a web page, which is a top news page from the IMDb website. For that purpose, create a parse_web_page.py script and write the following content in it:

import requestsfrom bs4 import BeautifulSouppage_result = requests.get('https://www.imdb.com/news/top?ref_=nv_nw_tp')parse_obj = BeautifulSoup(page_result.content, ...

Get Mastering Python Scripting for System Administrators now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.