Skip to main content

How to scrape Rotten Tomatoes website using an easy interface.

Project description

license

Rotten Tomatoes Scraper

You can extract information about movies and actors that are listed on the Rotten Tomatoes website using this module. Each movie has different metadata such as Rating, Genre, Box Office, Studio, and Scores. The Genre has 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 in highest-rated or filmography sections depending on your need. This module uses the BeautifulSoup package to parse HTML documents.

Install

The module requires the following libraries:

  • bs4
  • requests
  • lxml

Then, it can be installed using pip:

pip3 install rotten_tomatoes_scraper

Usage

This module contains three classes: CelebrityScraper, MovieScrape and DirectorScraper.

  • CelebrityScraper: You can use this class to extract the complete list of movies that a celebrity participated by calling extract_metadata method and using section='filmography'. Plus, you can also extract the list of top ranked movies by using the same method and section='highest'.
from rotten_tomatoes_scraper.rt_scraper import CelebrityScraper

celebrity_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 feed movie_url or movie_title to 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 using CelebrityScraper. Then, you must instantiate the MovieScraper and feed the movie_title to the extract_metada method. You can see the code below.
from rotten_tomatoes_scraper.rt_scraper import MovieScraper

movie_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']}
from rotten_tomatoes_scraper.rt_scraper import MovieScraper

movie_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 feed director_url or director_name to extract the director metadata.
from rotten_tomatoes_scraper.rt_scraper import DirectorScraper

director_scraper = DirectorScraper(director_url='https://www.rottentomatoes.com/celebrity/steven_spielberg')
director_scraper.extract_metadata()
movie_titles = director_scraper.metadata.keys()

print(director_scraper.metadata['Jaws'])
{'Year': '1975', 'Score_Rotten': '98', 'Box_Office': '260870000'}

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!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rotten_tomatoes_scraper-1.3.3.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rotten_tomatoes_scraper-1.3.3-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file rotten_tomatoes_scraper-1.3.3.tar.gz.

File metadata

  • Download URL: rotten_tomatoes_scraper-1.3.3.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.0

File hashes

Hashes for rotten_tomatoes_scraper-1.3.3.tar.gz
Algorithm Hash digest
SHA256 e54d195bd27b21e03632a931b9ed2a25a02af01e508ecda66285c7044fbc1b41
MD5 087662638d8f8e5669add8e30ee18709
BLAKE2b-256 ad9242f08f224803d297cc7e73ec3ab21e7c01533f7af97418c6c40ec4ea9802

See more details on using hashes here.

File details

Details for the file rotten_tomatoes_scraper-1.3.3-py3-none-any.whl.

File metadata

  • Download URL: rotten_tomatoes_scraper-1.3.3-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.0

File hashes

Hashes for rotten_tomatoes_scraper-1.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 bd32174cdb2d18ceabcc71322c0fc3689b9e300314478a9b232520503c141104
MD5 47b12b2d141e1bc19ec8ba95734e671e
BLAKE2b-256 4bb92d290abf58193451a489a0cf295af81e98c51121384117cc69c4df15caf9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page