Posts

Showing posts from October, 2024

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 ...