Messy track names in.
Structured data out.
npm install trackparseExtract, don't delete
Section titled “Extract, don't delete”Most title parsers split on the dash and hand you two strings. Others "clean" the title and throw the feature and the remix away with the brackets.
trackparse keeps everything. What it recognises goes into a labelled field, and what it doesn't stays in the title, word for word.
input 01. Wilkinson ft. Becky Hill & Tom Cane - Afterglow (Sub Focus VIP Remix) [Official Video]
| Split on the dash | trackparse | |
|---|---|---|
| Artist | Wilkinson ft. Becky Hill & Tom Cane | Wilkinson |
| Featured | lost | Becky Hill, Tom Cane |
| Title | Afterglow (Sub Focus VIP Remix) [Official Video] | Afterglow |
| Version | lost | remix + vip, by Sub Focus |
| Noise | lost | |
| Position | lost | 1 |
What you get
Section titled “What you get”Credits with roles
Primary artists, features, producers and remixers, each with the joiner it was written with.
Skrillex & Diplo x Justin Bieberis three artists; withknownArtists,Chase & Statusstays one.27 version types
Remix, VIP, bootleg, extended, radio edit, live, remaster, sped up, slowed and the rest, each with its remixers, modifiers and year.
Noise, labelled
[Official Video],[HD],- YouTubeand[NCS Release]leave the title but land injunkwith a kind, instead of disappearing.Whole tracklists
Paste the tracklist of a mix: every line is parsed, times are checked, and an out-of-order time often comes with the fix. Edits rewrite only the lines you name.
One spec, two languages
The JavaScript and Python packages pass the same 12,965 fixtures and return byte-identical JSON. A Rust port is next.
Small and total
No dependencies, about 17 kB gzipped, linear time. It never throws on a string, and bad options fall back to defaults.
- shared fixtures, 100% passing in both ports
- 12,965
- runtime dependencies
- 0
- version types, remix to nightcore
- 27
- differences between JS and Python output
- 0
Same call, same answer
Section titled “Same call, same answer”import { parse } from "trackparse";
const track = parse("Noisia feat. Foreign Beggars - Shellshock");track.artists.map((a) => `${a.name} (${a.role})`);// [ 'Noisia (primary)', 'Foreign Beggars (featured)' ]
parse("Queen - Bohemian Rhapsody (Live at Wembley 1986)").versions[0];// { type: 'live', descriptor: 'at Wembley', year: 1986, … }from trackparse import parse
track = parse("Noisia feat. Foreign Beggars - Shellshock")[f"{a.name} ({a.role})" for a in track.artists]# ['Noisia (primary)', 'Foreign Beggars (featured)']
parse("Queen - Bohemian Rhapsody (Live at Wembley 1986)").versions[0]# Version(type='live', ..., descriptor='at Wembley', year=1986, ...)