Skip to content

[Bug]: AppleMusicClient.gettoken() fails: regex '(?=eyJh)' may no longer match Apple Music's developer token #84

Description

@RudolfAnthony

Severity

S3 - Medium (workaround exists)

Version / Commit

v2.13.0

What happened?

AppleMusicClient.gettoken() in musicdl/modules/utils/appleutils.py raises:

Exception: Token not found in index.js page

This appears to affect Apple Music playlist parsing (parseplaylist) and full-song downloads.

What did you expect?

AppleMusicClient should successfully retrieve the Apple Music developer token and continue playlist parsing and song downloads.

Steps to reproduce

  1. Run:

musicdl -m AppleMusicClient
-p "https://music.apple.com/cn/playlist/example/pl.xxxx"
-i '{"AppleMusicClient":{"default_parse_cookies":"media-user-token=<valid_token>"}}'

  1. The command produces no output.

  2. The exception is likely suppressed by with suppress(Exception) in musicdl.py.

Logs / Screenshots

Exception:

Exception: Token not found in index.js page

Environment

  • OS: Windows 10 Pro for Workstations 22H2
  • OS Build: 19045.6466
  • Python: 3.13.9 (64-bit, MSC v.1944)
  • musicdl: v2.13.0
  • Platform: Windows x64

Checklist

  • I searched existing issues and did not find a duplicate.
  • I can reproduce this consistently.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions