Skip to content

Instantly share code, notes, and snippets.

@tomprogers
Last active July 27, 2018 00:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomprogers/aa198d44efdcf47c30a86cd948ef478d to your computer and use it in GitHub Desktop.
Save tomprogers/aa198d44efdcf47c30a86cd948ef478d to your computer and use it in GitHub Desktop.
Script for parsing the list of favorite songs on soma.fm into TSV format
// Step 1: open somafm player
// Step 2: click "Favorite Songs"
// Step 3: drag-select all the text from the first song title to shopping cart on last row
// Step 4: copy & paste that text into text2tsv in JS console
// Step 5: paste result into Google Docs and you have a spreadsheet
const text2tsv = (text) => text.split('\n\n \n')
.map( r => r.trim().split('\n\n') )
.map( t => ({ artist: String(t[0]).trim(), title: String(t[1]).trim() }) )
.map( t => `${t.artist}\t${t.title}` )
.join('\n')
copy( text2tsv(``) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment