Skip to content

Commit 306e5f3

Browse files
committed
Project Completed, readme left
1 parent 68794d8 commit 306e5f3

2 files changed

Lines changed: 43 additions & 14 deletions

File tree

projects/Find_imdb_rating/find_IMDb_rating.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,30 @@
22
import requests
33
import json
44
import pandas as pd
5+
import os
56

67
# Setting up session
78
s = requests.session()
89

9-
#File to write movies into
10-
11-
films = ['Star Wars: Episode V - The Empire Strikes Back', 'The wolf of wall street', 'Shutter Island']
10+
# List contaiting all the films for which data has to be scraped from IMDB
11+
films = []
1212

13+
# Lists contaiting web scraped data
1314
names = []
1415
ratings = []
1516
genres = []
1617

18+
# Define path where your films are present
19+
path = "/Users/utkarsh/Desktop/films"
20+
21+
# Films with extensions
22+
filmswe = os.listdir(path)
23+
24+
for film in filmswe:
25+
# Append into my films list (without extensions)
26+
films.append(os.path.splitext(film)[0])
27+
# print(os.path.splitext(film)[0])
28+
1729
for line in films:
1830
# x = line.split(", ")
1931
title = line.lower()
@@ -46,7 +58,6 @@
4658
if title in name:
4759
#scraping rating
4860
rating = result.find("div",class_="inline-block ratings-imdb-rating")["data-value"]
49-
# print(f"Rating of {name1}:", rating)
5061
#scraping genre
5162
genre = result.p.find("span", class_="genre")
5263
genre = genre.contents[0]
Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,33 @@
11
Film Name,Rating,Genre
2-
Star Wars: Episode V - The Empire Strikes Back,8.7,"
3-
Action, Adventure, Fantasy "
4-
Star Wars: Episode V - The Empire Strikes Back: Deleted Scenes,8.7,"
5-
Short, Action, Drama "
62
The Wolf of Wall Street,8.2,"
73
Biography, Crime, Drama "
84
The Wolf of Wall Street,6.5,"
95
Drama "
10-
Shutter Island,8.2,"
11-
Mystery, Thriller "
12-
Shutter Island: Into the Lighthouse,8.8,"
13-
Documentary, Short "
14-
Shutter Island: Behind the Shutters,8.4,"
15-
Documentary, Short "
6+
Star Wars: Episode IX - The Rise of Skywalker,6.6,"
7+
Action, Adventure, Fantasy "
8+
Solo: A Star Wars Story,6.9,"
9+
Action, Adventure, Sci-Fi "
10+
Star Wars: The Clone Wars,8.2,"
11+
Animation, Action, Adventure "
12+
Star Wars,8.6,"
13+
Action, Adventure, Fantasy "
14+
Star Wars: Episode I - The Phantom Menace,6.5,"
15+
Action, Adventure, Fantasy "
16+
Star Wars: The Last Jedi,7,"
17+
Action, Adventure, Fantasy "
18+
Star Wars: Episode V - The Empire Strikes Back,8.7,"
19+
Action, Adventure, Fantasy "
20+
Star Wars: The Force Awakens,7.9,"
21+
Action, Adventure, Sci-Fi "
22+
Star Wars: Episode VI - Return of the Jedi,8.3,"
23+
Action, Adventure, Fantasy "
24+
Star Wars: Rebels,8,"
25+
Animation, Action, Adventure "
26+
Star Wars: Episode III - Revenge of the Sith,7.5,"
27+
Action, Adventure, Fantasy "
28+
Star Wars: Episode II - Attack of the Clones,6.5,"
29+
Action, Adventure, Fantasy "
30+
Star Wars Jedi: Fallen Order,8.7,"
31+
Action, Adventure, Drama "
32+
Star Wars: Resistance,4.9,"
33+
Animation, Action, Adventure "

0 commit comments

Comments
 (0)