Posts

IMDb Visualization Script Using Matplotlib

Image
IMDb Ratings Visualization Script This Python script allows users to load IMDb movie data from a SQL Server database and visualize the IMDb ratings of the first and last 6 movies in various categories, such as by alphabetic order, number of ratings, popularity, release date, runtime, and user ratings. The script generates horizontal bar charts with a color gradient based on IMDb ratings to easily compare different movies. When you run this code, it will prompt the user to choose a file to display a graph. Choose a file to view: 1 - Alphabetic 2 - Num Rating 3 - Popularity 4 - Release Date 5 - Runtime 6 - User Rating 7 - Lowest Rated 8 - Type 'all' to see all files sequentially 0 - Exit Enter your choice:  Import Important Libraries Copy import pyodbc import pandas as pd import matplotlib.pyplot as plt from matplotlib import colors as mcolors Features: 1. File Paths and SQL Table Mappings for IMDb Data Visualization The file_paths dictionary stores predefined file paths, e...

Scraping IMDB Top 250 Movies Data Using Selenium & Store into SQL

Image
A Complete Code to Scrape IMDB Data using Selenium (Python ) Copy # Copyright 2024 | Faisal Rafiq import time from selenium import webdriver from selenium.webdriver.chrome.service import Service from selenium.webdriver.common.by import By from webdriver_manager.chrome import ChromeDriverManager # Import WebDriver Manager import pyodbc import json headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36' } def scrape_imdb_top_250(): url = 'https://www.imdb.com/chart/top/' # Set up the Chrome WebDriver using WebDriver Manager options = webdriver.ChromeOptions() options.add_argument(f"user-agent={headers['User-Agent']}") service = Service(ChromeDriverManager().install()) driver = webdriver.Chrome(service=service, options=options) driver.get(url) time.sleep(3) # Click the button to trigger the detailed view ...

A Simple Guide to Scraping IMDB Data Using Selenium & Store into SQL

Image
Overview In this project, I’ll walk you through how to scrape movie data from the IMDb website, store it in an SQL database, and finally, visualize it using Python’s Matplotlib library. Part 1: Scraping IMDb with Selenium We’ll start by using Selenium , a powerful tool that allows us to automate web browsing. With Selenium, we can extract data like movie titles, ratings, and release dates directly from IMDb. Instead of manually going through each movie, Selenium will do the job for us! Part 2: Storing Data in SQL Database Once we have the data, the next step is to store it in an SQL database . This way, we can easily manage and retrieve the information anytime we need it. SQL databases are perfect for handling large sets of structured data, and I’ll show you how to insert our scraped movie data directly into a database. Part 3: Visualizing with Matplotlib After storing the data, we’ll use M atplotlib to create stunning visualizations. Whether it’s showing the top 10 rated movies or an...