Skip to main content

AlbumOfTheYearWrapper

A light weight python library that acts as an API for https://www.albumoftheyear.org/
Tests PyPI

Description

Gets data from https://www.albumoftheyear.org/. The website doesn't currently provide API support so web parsing is required to obtain data. Because of this, and according to https://www.albumoftheyear.org/robots.txt, searching and POST requests are not allowed.

Cloudflare / browser cookies

albumoftheyear.org sits behind Cloudflare bot protection. Automated requests often receive a 403 "Just a moment..." challenge. When that happens, this library raises CloudflareBlockedError.

To get through with a browser session you need:

  1. curl_cffi (pulled in via requirements.txt) — Cloudflare checks TLS fingerprint; plain urllib/requests will still fail even with valid cookies.
  2. Browser cookies (especially cf_clearance) from a session that already passed the check.
  3. The same User-Agent as that browser.
from albumoftheyearapi import AOTY

client = AOTY(
    cookies="cf_clearance=...; PHPSESSID=...",  # full Cookie header from DevTools Network
    user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 "
               "(KHTML, like Gecko) Chrome/154.0.0.0 Safari/537.36",
)
print(client.artist_name("183-kanye-west"))

Or set env vars:

AOTY_COOKIES=cf_clearance=...; PHPSESSID=...
AOTY_USER_AGENT=Mozilla/5.0 ...

Copy the Cookie header from DevTools → Network → the document request (not the challenge POST). Cookies expire; refresh them when requests fail again.

The client also spaces requests (AOTY_MIN_REQUEST_INTERVAL, default 0.75s) and retries HTTP 429 with backoff (AOTY_MAX_RETRIES, default 5). Live pytest integration tests skip automatically when Cloudflare is blocking.

Installation

pip install album-of-the-year-api

or upgrade

pip install album-of-the-year-api --upgrade

Usage

Examples

Here's a quick example of getting a specific users follower count

from albumoftheyearapi import AOTY

client = AOTY()
print(client.user_follower_count('jahsias'))

>> 0

If you don't need the full functionality, you can also import only the neccesary files

from albumoftheyearapi.artist import ArtistMethods

client = ArtistMethods()
print(client.artist_albums('183-kanye-west'))

>> ['Donda 2', 'Donda', 'JESUS IS KING', 'ye', 'The Life of Pablo', 'Yeezus', 'Watch the Throne', 'My Beautiful Dark Twisted Fantasy', '808s & Heartbreak', 'Graduation', 'Late Registration', 'The College Dropout']

Notice artists also need their unique id along with their name

Each function also is able to return the data in JSON format

from albumoftheyearapi import AOTY

client = AOTY()
print(client.artist_critic_score_json('183-kanye-west'))

>> {"critic_score": "73"}

For detailed information, refer to the Full API Documentation.

Metadata

Release files for album-of-the-year-api 0.2.13

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

Source distribution (sdist)

Source distribution for album-of-the-year-api 0.2.13
File Size Uploaded Provenance Actions
album_of_the_year_api-0.2.13.tar.gz 13.1 kB Without provenance Details for album_of_the_year_api-0.2.13.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for album-of-the-year-api 0.2.13
File Interpreter ABI Platform Actions
album_of_the_year_api-0.2.13-py3-none-any.whl Python 3 none any Details for album_of_the_year_api-0.2.13-py3-none-any.whl

Total release size: 28.9 kB

Release files / album_of_the_year_api-0.2.13.tar.gz

Download URL album_of_the_year_api-0.2.13.tar.gz
Size 13.1 kB
Tags Source
SHA-256 checksum
How to use checksums
28f5fd95fb0cacf3114445c25fb6ea3951fd812979e68002b6ae692abc915898
BLAKE2b-256 checksum
How to use checksums
8beeda90a8dfad6a5ff4218f7b285eb178a3d85c4bd4c0e62345d94775d1d795
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.19

Release files / album_of_the_year_api-0.2.13-py3-none-any.whl

Download URL album_of_the_year_api-0.2.13-py3-none-any.whl
Size 15.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
783a9c7f30004ead8d3f44d11b1c8396206ca0cfda53d2fe755de16dbc1aacf6
BLAKE2b-256 checksum
How to use checksums
50376de6ccbc2d3886f23a9d6baa09ba90e8832e7d7e5c899c73b05a01ec768d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.19

Security for album-of-the-year-api 0.2.13

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