Fetch Animated Artworks

Fetch Animated Artworks

Website & API to fetch and download animated artworks from Apple Music

Apple Music offers animated album covers that elevate the visual experience of music to a new level. Unfortunately, these aren't easily accessible or usable in other applications. That's why I developed Apple Music Animated Artworks. A lightweight tool and API that extracts the links to Apple Music's artworks and makes them usable.

The Idea

The goal of the project was to create an easy way to find and download animated covers. The tool not only supports the standard square artworks but also the portrait-oriented ("Tall") versions used in vertical UIs.

Thanks to the REST API, other music players can also access animated covers:

Core Features

An overview of the core features:

  • Flexible Search: Users can search directly by artist and album or simply paste an Apple Music URL.

  • Real-time Scraping: The backend scrapes the native .m3u8 (HLS) video stream URLs from Apple Music.

  • Cross-Browser Web Player: Since native HLS playback isn't supported by all browsers (except Safari), the frontend uses hls.js to render the animations smoothly everywhere.

  • Download Options: Users can download the artworks as .mp4 or .webp. Downloading and conversion from the Apple servers happen client-side.

Tech Stack & Architecture

For this project, I wanted to use a modern, performant, and easily deployable architecture.

  • Backend: A .NET 10 application relying on APIs, HttpClient, and regular expressions (Regex) for parsing metadata.
  • Frontend: A minimalist user interface built with Plain JavaScript and Tailwind CSS.
  • Deployment: The entire system is containerized and can be hosted locally or on any server with a simple docker compose up.

The REST API

For developers who want to integrate animated covers into their own projects (e.g., music players), the backend provides a public REST API.

The database can be queried with simple GET requests:

GET /api/v1/artwork/search?artist=Linkin+Park&album=Living+Things
GET /api/v1/artwork/url?url=https://music.apple.com/...

Smart Caching: Performant and "Apple-Friendly"

One of the biggest problems with web scraping is rate limits and redundant network requests. Especially with the massive traffic hitting the public instance of the API, this can quickly lead to blocks.

Cloudflare stats of the public instance of Apple Music Animated Artworks: Artikel Bild

To go easy on Apple's servers and drastically reduce the API's response times, I implemented a thoughtful caching strategy:

1. Fuzzy Matching: The search uses normalized substring matching. If someone searches for the standard album, already cached "Deluxe" or "Remastered" versions are also recognized and returned.

2. Negative Artwork Caching: If an album definitely does not have an animated cover, it gets cached with the status NONE. This prevents the system from launching pointless scraping attempts on subsequent requests.

3. Negative Search Caching: The same applies to search queries that return no results at all. These empty hits are also temporarily stored.

Conclusion

This project was an exciting challenge to dive deeper into .NET Minimal APIs and HLS video streams. It shows how, with clean architecture and efficient caching, you can build a useful tool that is publicly accessible without immediately running into API limits.

(Note: This project is strictly for educational purposes and uses publicly accessible metadata.)