Package: rotten-tomatoes-scraper
Rotten Tomatoes ScraperYou can extract information aboutmoviesandactorsthat are listed on the Rotten Tomatoes website using this
module. Each movie has different metadata such asRating,Genre,Box Office,Studio, andScores. TheGenrehas 20+ subcategories that also gives you more granular information on a movie. These metadata can be helpful
for many data science projects. For actors you can extract movies listed inhighest-ratedorfilmographysections depending on your need. This module uses the BeautifulSoup package to parse HTML documents.InstallThe module requires the following libraries:bs4requestslxmlThen, it can be installed using pip:pip3installrotten_tomatoes_scraperUsageThis module contains three classes:CelebrityScraper,MovieScrapeandDirectorScraper.CelebrityScraper: You can use this class to extract the complete list of movies that a celebrity participated by callingextract_metadatamethod and usingsection='filmography'. Plus, you can also extract the list of top ranked movies by using the same method andsection='highest'.fromrotten_tomatoes_scraper.rt_scraperimportCelebrityScrapercelebrity_scraper=CelebrityScraper(celebrity_name='jack nicholson')celebrity_scraper.extract_metadata(section='highest')movie_titles=celebrity_scraper.metadata['movie_titles']print(movie_titles)['On a Clear Day You Can See Forever','The Shooting','Chinatown','Broadcast News']MovieScraper: You can use this class to extract metadata of movies. You can feedmovie_urlormovie_titleto extract the movie metadata. If you want to find out what movie genres an actor has
participated, you can, first, extract the list of movies that he or she participated usingCelebrityScraper. Then, you
must instantiate theMovieScraperand feed themovie_titleto theextract_metadamethod.  You can see the code below.fromrotten_tomatoes_scraper.rt_scraperimportMovieScrapermovie_scraper=MovieScraper(movie_title='Vicky Cristina Barcelona')movie_scraper.extract_metadata()print(movie_scraper.metadata){'Score_Rotten':'81','Score_Audience':'74','Genre':['comedy','drama','romance']}fromrotten_tomatoes_scraper.rt_scraperimportMovieScrapermovie_url='https://www.rottentomatoes.com/m/marriage_story_2019'movie_scraper=MovieScraper(movie_url=movie_url)movie_scraper.extract_metadata()print(movie_scraper.metadata){'Score_Rotten':'94','Score_Audience':'85','Genre':['comedy','drama']}DirectorScraper: You can use this class to extract metadata of directors. You can feeddirector_urlordirector_nameto extract the director metadata.fromrotten_tomatoes_scraper.rt_scraperimportDirectorScraperdirector_url='https://www.rottentomatoes.com/celebrity/steven_spielberg'director_scraper=DirectorScraper(director_url=director_url)director_scraper.extract_metadata()print(director_scraper.metadata['Jaws']){'Year':'1975','Score_Rotten':'98','Box_Office':'260870000'}fromrotten_tomatoes_scraper.rt_scraperimportDirectorScraperdirector_scraper=DirectorScraper(director_name='stanley kubrick')director_scraper.extract_metadata()movie_titles=list(director_scraper.metadata.keys())print(movie_titles)['Eyes Wide Shut','Full Metal Jacket','The Shining','Barry Lyndon','A Clockwork Orange','2001: A Space Odyssey','Dr. Strangelove Or: How I Learned to Stop Worrying and Love the Bomb','Lolita','Spartacus','Paths of Glory','The Killing',"Killer's Kiss",'The Seafarers','Fear and Desire','Day of the Fight','Flying Padre']This module doesn't give you a full access to all the metadata that you may find in Rotten Tomatoes website. However,
you can easily use it to extract the most important ones.And, that's pretty much it!