![]() |
VOOZH | about |
We can scrape the IMDb movie ratings and their details with the help of the BeautifulSoup library of Python.
Below is the list of modules required to scrape from IMDB.
Steps to implement web scraping in python to extract IMDb movie ratings and its ratings:
1. Import the required modules.
2. Access the HTML content from the IMDb Top 250 movies page
3. Extract movie details using HTML tags, each li tag represents a movie block containing title, year, and rating details.
4. Create a list to store movie data
5. Display the extracted data
6. Save the data into a CSV file
Output
Title Year Rating
1. The Shawshank Redemption N/A 9.3 (3.1M)
2. The Godfather N/A 9.2 (2.2M)
3. The Dark Knight N/A 9.1 (3.1M)
4. The Godfather: Part II N/A 9.0 (1.5M)
5. 12 Angry Men N/A 9.0 (955K)
IMDb data saved successfully to imdb_top_250_movies.csv!
Along with this in the terminal, a .csv file with a given name is saved in the same file and the data in the .csv file will be as shown in the following image.