Download Beats from Beatstars for Free

Install

1
brew install curl wget jq

Add to ~/.zprofile

1
2
3
4
5
6
7
beatstars_download () {
    readonly url=${1:?"The url must be specified."} 
    local id=`echo $url | grep -o '[^-]*$'`
    curl -s https://main.v2.beatstars.com/track/\?id\="$id" | 
        jq -r '.response.data.details.stream_url' | 
        xargs wget --content-disposition -O "$id".mp3
}

Usage

1
beatstars_download <url>

Example

You like the beat https://www.beatstars.com/beat/missing-you-softly-8447468

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
$ beatstars_download https://www.beatstars.com/beat/missing-you-softly-8447468

--2021-06-26 14:50:55--  https://main.v2.beatstars.com/stream?id=8447468&return=audio&timestamp=1624708255
Resolving main.v2.beatstars.com (main.v2.beatstars.com)... 18.213.174.19, 54.227.58.191, 54.81.232.123, ...
Connecting to main.v2.beatstars.com (main.v2.beatstars.com)|18.213.174.19|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://content.beatstars.com/users/prod/1700675/a10g8z2fsy.mp3 [following]
--2021-06-26 14:50:55--  https://content.beatstars.com/users/prod/1700675/a10g8z2fsy.mp3
Resolving content.beatstars.com (content.beatstars.com)... 13.32.14.66, 13.32.14.36, 13.32.14.10, ...
Connecting to content.beatstars.com (content.beatstars.com)|13.32.14.66|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 7169044 (6,8M) [audio/mp3]
Saving to: ‘8447468.mp3’

8447468.mp3         100%[===================>]   6,84M  8,80MB/s    in 0,8s    

2021-06-26 14:50:57 (8,80 MB/s) - ‘8447468.mp3’ saved [7169044/7169044]