Skip to main content

Unofficial Python API for Box Office Mojo

Project description

Unofficial Python API for Box Office Mojo

This Python package allows you to retrieve box office information from Box Office Mojo. It provides data on daily, weekly, monthly, seasonal, quarterly, and yearly box office performance for movies. Additionally, it can fetch additional movie details like posters, descriptions, directors, and more from OMDb API when an API key is provided.

Installation

You can install this package using pip:

pip install boxoffice_api

Usage

Here's how you can use this package to retrieve box office information: if You want to have more information from Movies you can get free API key From "https://www.omdbapi.com/" free account have 1000 daily requests

from boxoffice_api import BoxOffice 

if you have API Key

class box_office = BoxOffice(api_key="your_api_key") # Get daily box office information for a specific date 

if you want to use the package without API Key

class box_office = BoxOffice()

Getting Information

daily_data = box_office.get_daily("2023-09-21") # Get weekend box office information for a specific year and week 
weekend_data = box_office.get_weekend(year=2023, week=39) # Get weekly box office information for a specific year and week 
weekly_data = box_office.get_weekly(year=2023, week=39) # Get monthly box office information for a specific year and month 
monthly_data = box_office.get_monthly(year=2023, month=9) # Get seasonal box office information for a specific year and season 
seasonal_data = box_office.get_season(year=2023, season="fall") # Get quarterly box office information for a specific quarter and year 
quarterly_data = box_office.get_quarterly(quarterly=3, year=2023) # Get yearly box office information for a specific year 
yearly_data = box_office.get_yearly(year=2023) # Access the data as a list of dictionaries for movie in daily_data: print(movie)

Please replace "your_api_key" with your actual OMDb API key if you want to fetch additional movie details.

Documentation

BoxOffice(api_key=None): Initializes the BoxOffice class with an optional OMDb API key.

get_daily(date): Retrieves daily box office information for a specific date.

get_weekend(year, week): Retrieves weekend box office information for a specific year and week.

get_weekly(year, week): Retrieves weekly box office information for a specific year and week.

get_monthly(year, month): Retrieves monthly box office information for a specific year and month.

get_season(year, season): Retrieves seasonal box office information for a specific year and season.

get_quarterly(quarterly, year): Retrieves quarterly box office information for a specific quarter and year.

get_yearly(year): Retrieves yearly box office information for a specific year.

Output Example:

print(daily_records[0])
>>>
{
    'rank': '1',
    'yesterday rank': '1',
    'title': 'Thor: Love and Thunder',
    'daily gross': '$14,354,321',
    'gross change daily': '-22.4%',
    'gross change week': '-55.8%',
    'theaters': '4,375',
    'per theaters avg gross': '$3,280',
    'gross to date': '$233,903,308',
    'number of days release': '10',
    'Distributor': 'Walt Disney Studios Motion Pictures'
}

Dependencies

This package relies on the following Python libraries:

BeautifulSoup
requests

Please make sure to install these dependencies before using the package.

Note

When using an OMDb API key, you can access additional movie details such as movie posters, descriptions, directors, actors, and more.

The package may make multiple requests to fetch movie details, so be mindful of your API limits, especially if you have a free API key.

Ensure you have a stable internet connection when making requests to Box Office Mojo and OMDb API.

Author

This Python package was created by Pourya Mohamadi. Feel free to contact fresh.pourya@gmail.com

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

boxoffice_api-0.1.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

boxoffice_api-0.1-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file boxoffice_api-0.1.tar.gz.

File metadata

  • Download URL: boxoffice_api-0.1.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for boxoffice_api-0.1.tar.gz
Algorithm Hash digest
SHA256 91a2ecd3989fdc98390bf8bdfc4503eba8e2336917f495dea1d7963a6b69b6f3
MD5 035a6d5ad8546feee49f4343f67903b3
BLAKE2b-256 50f86abe1603e40a7c3d1a7996816e69b1bb6842a3caec1c3cfa22665b4834ec

See more details on using hashes here.

File details

Details for the file boxoffice_api-0.1-py3-none-any.whl.

File metadata

  • Download URL: boxoffice_api-0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for boxoffice_api-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b494493a5b44cc8c6bcb8466f4d9e2247b380dc8e92de6a1f43be08623b8e420
MD5 38ea9f0b733d76725e1135753cb47424
BLAKE2b-256 53b059e50d798d2ca5ef68908868db837a22e925af38f6b47f4919b581a3f984

See more details on using hashes here.

Supported by

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