Skip to content

Instantly share code, notes, and snippets.

@peanutbother
peanutbother / main.rs
Last active March 31, 2023 20:29
Rustdoc proc_macro_attribute which adds boilerplate for a doctest
/// This struct shows an example
///
/// # Example
#[doc_add_boilerplate(
/// # // you can use hidden lines
/// MyStruct::greet(); // this line is visible
)]
struct MyStruct;
@peanutbother
peanutbother / apple_music_api.md
Created June 11, 2026 21:14 — forked from sayeed205/apple_music_api.md
Use apple music API free

Apple Music API Token Guide

This guide helps you extract a developer token dynamically from Apple Music's public site (https://beta.music.apple.com) and use it to access metadata for songs or albums via Apple’s internal amp-api.

Disclaimer

The unofficial method of scraping tokens from the Apple Music website is not sanctioned by Apple and is subject to break without notice if the website's structure is updated. For production applications, the official developer token method is strongly recommended due to its stability and reliability.

How It Works

The process can be broken down into two main steps:

  1. Find the Core JavaScript File: The initial step is to fetch the HTML of the Apple Music beta website (https://beta.music.apple.com). Within this HTML, we look for a reference to a specific JavaScript file, typically named in a pattern like index-legacy-[hash].js. This file contains the necessary logic and, more importantly, the token.