Retrieve detailed information about a music track or download the audio file. This feature requires TikTok cookie authentication.
How to get TikTok cookie
- Open TikTok in your browser and login.
- Open DevTools (F12).
- Go to Application/Storage > Cookies.
- Copy the entire cookie value.
- Set it in the CLI using:
tiktokdl cookie set "YOUR_COOKIE".
Node.js API
Use Tiktok.GetMusicDetail(idOrUrl, options).
Options:
cookie (string, required): Your TikTok cookie.proxy (string, optional): Proxy URL.
CLI Usage
Note: You must set your cookie first using tiktokdl cookie set <value>.
Get Music Details:
# Get music detail by ID
tiktokdl getmusicdetail 7562597337407785760
# Get music detail by URL
tiktokdl getmusicdetail "https://www.tiktok.com/music/QKThr-6771810675950880769"
# Get music detail with proxy
tiktokdl getmusicdetail 7562597337407785760 --proxy "http://your-proxy-url"
# Get raw JSON response
tiktokdl getmusicdetail 7562597337407785760 -r
Download Music/Audio:
# Download by music ID
tiktokdl downloadmusic 7562597337407785760
# Download by music URL
tiktokdl downloadmusic "https://www.tiktok.com/music/QKThr-6771810675950880769"
# Custom output directory
tiktokdl downloadmusic 7562597337407785760 -o "./my-music"
# With proxy
tiktokdl downloadmusic 7562597337407785760 --proxy "http://your-proxy-url"
const Tiktok = require("@tobyg74/tiktok-api-dl")
// Using music ID
const musicId = "7562597337407785760"
Tiktok.GetMusicDetail(musicId, {
cookie: "YOUR_COOKIE", // required
proxy: "YOUR_PROXY" // optional
}).then((result) => console.log(result))
// Or using music URL
const musicUrl = "https://www.tiktok.com/music/QKThr-6771810675950880769"
Tiktok.GetMusicDetail(musicUrl, {
cookie: "YOUR_COOKIE"
}).then((result) => console.log(result))