Skip to content

Getting started

  1. Install the package.

    npm install trackparse # or: pnpm add / yarn add / bun add trackparse

    Node 18 or newer, or any runtime with ES2020. ESM and CommonJS both work, and the types are included.

  2. 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'
  3. 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' ]
  4. 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' ]