Skip to content

feat: Apple Music source#636

Draft
Exerra wants to merge 14 commits into
FoxxMD:masterfrom
Exerra:feat/apple-music
Draft

feat: Apple Music source#636
Exerra wants to merge 14 commits into
FoxxMD:masterfrom
Exerra:feat/apple-music

Conversation

@Exerra

@Exerra Exerra commented Jul 13, 2026

Copy link
Copy Markdown

Checklist before requesting a review

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

Describe your changes

Adds an Apple Music source.

Authentication methods include:

  • Paid Apple Developer program key + Media User Token grabbed from music.apple.com cookies (key expiry 180d, MUT - no idea)
  • Bearer token + Media User Token grabbed from music.apple.com cookies + Origin header (token expiry 35d from issue, but when grabbed it could already be nearing expiration, MUT - no idea)

This is a draft PR while I add more QOL features like re-auth when using a key, etc. Documentation will also need to be updated to reflect both the auth methods as well as the downsides of both.

TODO:

  • Update package-lock.json once package version is +/- finalised (I use Bun so package-lock.json doesn't get generated)
  • Add docs

Issue number and link, if applicable

#9

Exerra added 11 commits July 14, 2026 00:24
Implement Apple Music source, including configuration types, environment variable handling, and source initialization logic. Refactored SourceType definitions to improve maintainability.
Removed the unused `getBackloggedPlays` method and cleaned up the `getRecentlyDiscoveredPlays` logic in `AppleMusicSource` to streamline track processing.
…ng type

Removed local AppleMusicTrack interface and updated formatPlayObj to utilize the shared Song type for improved type consistency.
Refactored AppleMusicSource to use defined types for history consistency, updated the getRecentlyPlayedTracks limit type, and renamed variable for clarity.
Introduced constants for history limits and track polling constraints to improve maintainability and readability within AppleMusicSource.
Cleaned up the type casting in the AppleMusicSource fetch logic by removing unnecessary unknown assertion.
Moved the reduceRight logic for calculating play timestamps into a dedicated private method 'applyCalculatedTimestamps' to improve code readability and maintainability.
Updated comments in applyCalculatedTimestamps to reflect that Apple Music lacks track timestamps, necessitating a hacky estimation method.
Update parseRecentAgainstResponse return type signature to use the HistoryConsistencyResult alias instead of an inline object definition.
Introduced a `headers` configuration option to allow setting custom request headers, such as 'Origin', for Apple Music API requests. Updated configuration schema and source implementation to apply these headers.
Switched node-musickit-api dependency from a local path to version 3.1.0-next.4 from the registry.
@netlify

netlify Bot commented Jul 13, 2026

Copy link
Copy Markdown

Deploy Preview for multi-scrobbler ready!

Name Link
🔨 Latest commit 4ae3886
🔍 Latest deploy log https://app.netlify.com/projects/multi-scrobbler/deploys/6a5619ae3a9dcb0008b1498c
😎 Deploy Preview https://deploy-preview-636--multi-scrobbler.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@Exerra

Exerra commented Jul 13, 2026

Copy link
Copy Markdown
Author

Okay, Netlify reveals peer dep issues with Typescript for node-musickit-api (ts v6 here, ts v5 for the package). Will have to investigate.

edit: Fixed with v3.1.0-next.5

@Exerra Exerra changed the title Feat: Apple Music source feat: Apple Music source Jul 13, 2026
@FoxxMD FoxxMD added the safe to test trusted to build image label Jul 14, 2026
Exerra added 3 commits July 14, 2026 13:08
Updated node-musickit-api dependency to the latest next version.
Add Apple Music to the sources overview table and the main documentation index.
Bump node-musickit-api to 3.1.0-next.5
@github-actions

Copy link
Copy Markdown
Contributor

📦 A new release has been made for this pull request.

To play around with this PR, pull an image:

  • foxxmd/multi-scrobbler:pr-636

Images are available for x86_64 and ARM64.

Latest commit: 4ae3886

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test trusted to build image

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants