Getting started
-
Install the package.
npm install trackparse # or: pnpm add / yarn add / bun add trackparseNode 18 or newer, or any runtime with ES2020. ESM and CommonJS both work, and the types are included.
pip install trackparse # or: uv add trackparsePython 3.9 or newer, no dependencies. The package ships
py.typedand passesmypy --strict. -
Parse a track.
import { parse } from "trackparse";// CommonJS: const { parse } = require("trackparse");const track = parse("Noisia feat. Foreign Beggars - Shellshock");track.title; // 'Shellshock'track.artists.map((a) => a.name); // [ 'Noisia', 'Foreign Beggars' ]track.artists[1].role; // 'featured'from trackparse import parsetrack = parse("Noisia feat. Foreign Beggars - Shellshock")track.title # 'Shellshock'[a.name for a in track.artists] # ['Noisia', 'Foreign Beggars']track.artists[1].role # 'featured' -
Look at the versions and the noise.
const t = parse("Daft Punk - One More Time (Official Music Video) [HD]");t.title; // 'One More Time't.junk; // [ { raw: 'Official Music Video', kind: 'video' }, { raw: 'HD', kind: 'quality' } ]const r = parse("Dimension - Offshore (Mefjus Remix / Noisia Remix)");r.versions.map((v) => `${v.type} by ${v.artists[0].name}`);// [ 'remix by Mefjus', 'remix by Noisia' ]t = parse("Daft Punk - One More Time (Official Music Video) [HD]")t.title # 'One More Time't.junk # (Junk(raw='Official Music Video', kind='video'), Junk(raw='HD', kind='quality'))r = parse("Dimension - Offshore (Mefjus Remix / Noisia Remix)")[f"{v.type} by {v.artists[0].name}" for v in r.versions]# ['remix by Mefjus', 'remix by Noisia'] -
Tell it about names that contain a joiner.
parse("Chase & Status - Baddadan").artists.map((a) => a.name);// [ 'Chase', 'Status' ]parse("Chase & Status - Baddadan", { knownArtists: ["Chase & Status"] }).artists.map((a) => a.name);// [ 'Chase & Status' ][a.name for a in parse("Chase & Status - Baddadan").artists]# ['Chase', 'Status'][a.name for a in parse("Chase & Status - Baddadan", known_artists=["Chase & Status"]).artists]# ['Chase & Status']
- Try your own strings in the playground.
- What it understands is a tour of real inputs.
- Working with mixes? Read Tracklists.