Skip to main content

Unofficial Python API for Box Office Mojo

Please give package a start if you use it in your projects

update Note you can now get a panda Dataframe as output

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 we highly recommend if you want to use this package for collecting data and don't want to use thing like movie posters etc . don't use the API key

from boxoffice_api import BoxOffice 

if you have API Key

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

box_office = BoxOffice()

if you want to use the package without API key and get panda Dataframe as output

box_office = BoxOffice(outputformat="DF")

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): Retrieve 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): Retrieve weekly box office information for a specific year and week.

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

get_season(year, season): Retrieve 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

Metadata

Release files for boxoffice-api 1.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for boxoffice-api 1.2.2
File Size Uploaded Provenance
boxoffice_api-1.2.2.tar.gz 6.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for boxoffice-api 1.2.2
File Interpreter ABI Platform
boxoffice_api-1.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 13.6 kB

Release files / boxoffice_api-1.2.2.tar.gz

Download URL boxoffice_api-1.2.2.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
356e728d05240e84d1a154ce19d67941b8e47d18b84fefe6a8268455be61afee
BLAKE2b-256 checksum
How to use checksums
e290ca6346d7be19804430bae8a0b4a1dc23f7baca7464f39ddc85b6f316bc07
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.2

Release files / boxoffice_api-1.2.2-py3-none-any.whl

Download URL boxoffice_api-1.2.2-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
72575c6d6b0317a87465bfb1ace2ca742202b6ec144a49ee5a92c37111d00c04
BLAKE2b-256 checksum
How to use checksums
e31706120b5a6179a964a1f79b49cca0d44fae5be66f30d10e424b933d2e349c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.2

Security for boxoffice-api 1.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page