Skip to content

AlexSongh/SI507_Final_Project_W21

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Name: Hang Song

unique: hangsong

IMDB Top Movies and Create Your Favorite Movie Database Program

Data Sources:

IMDB Top 250: Main page[https://www.imdb.com/chart/top/] + 250 individual movie pages (challenge score 8: Crawling [and scraping] multiple pages in a site you haven’t used before) iTunes API (challenge score 2: Web API you’ve used before)

Packages required:

bs4, requests, sqlite3, json

Description:

This code will show the top IMDb movies (ranging from 0 to 250). You can find detailed information of the movie, plot summary of the movie, and more representative movies of the stars in that movie using iTunes API requests. And also you can save the top 250 movies in your personalized movie database. Also a graphic summary (bar plot) will be provided for your database. For example, how many movies are in 1990s, how many movies are R rated, how many movies is starred by Tim Robbins, how may movies is directed by Christopher Nolan.

final_project.py:

Description: contains interactive program and other project code.

PROCESSING FUNCTIONS:

init_fav_db(): This function deletes any previous database containing tables "Movies", "MovieRatings", and reconstructs the tables with different necessary fields.

insert_fav_db: This function will update the information of the Movie instance in the Table "Movies".

open_cache(): open the cache json file.

save_cache(): update the cache file when fetching new information that is not saved in the cache json previously.

make_request_with_cache(): Check the cache for a saved result for this baseurl+params:values combo. If the result is found, return it. Otherwise send a new request, save it, then return it

build_movie_url_dict(): Make a dictionary that maps ranking to movie page url

create_movie_instance(): Make a Movie instance from movie URL

display_top(): Display the top results of the top movies in IMDb

get_itunes_data(): Get iTunes data from iTunes API based on the search and limit query

show_star_more(): Show more movies of the stars from the movie

plot_time(), plot_rating(),plot_stars(),plot_director(): draw barplot from a list of movie instances for diffrent categories.

interactive_design(): Main interactive program code

User Guide:

final_project.py:

Simply run the program. The instructions is also embedded in the interactive program as well.

Step 1:

Enter a number to tell the program how many results top movies to show. Or enter "exit" to end the program.

Step 2:

Enter a specific number to show the detailed information of the movie; Or enter "return" to go back to the upper level Step 1; Or enter "exit" to end the program.

Step 3:

Enter "summary" for plot summary; Or enter "stars" for more movies of the related stars; Or enter "save" to save the movie in your favorite movie database called "favmovie.sqlite"; Or enter "showdb" to continue Step 4.

Step 4:

Enter "time" to show how many movies in each decade in your current database to get an insight of your movie taste; Or enter "rating" to show movie_ratings of your favorite movies in movie database; Or enter "stars" to show number of movies associated with the stars of the movies you saved in movie database; Or enter "director" to show number of movies associated with directors of the movies you saved in movie database; Or enter "return" to go back to the upper level Step 2; Or enter "exit" to end the program.

Afterwards, you got a sqlite movie database stored the movies for your information.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages