Skip to content

Instantly share code, notes, and snippets.

@loretoparisi
Created February 11, 2020 15:42
Show Gist options
  • Save loretoparisi/b6d4d273ef27c5a2f5048f91b53f6be9 to your computer and use it in GitHub Desktop.
Save loretoparisi/b6d4d273ef27c5a2f5048f91b53f6be9 to your computer and use it in GitHub Desktop.
Mixing Secrets Audio Tracks Dataset - http://www.cambridge-mt.com/ms/mtk/
script = document.createElement('script');script.src = "https://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js";document.getElementsByTagName('head')[0].appendChild(script);
function download(name,jsonObject) {
var fileContents = JSON.stringify(jsonObject, null, 2);
var pp = document.createElement('a');
pp.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(fileContents));
pp.setAttribute('download', name+'.json');
pp.click();
}
df=[]
$('.m-mtk-track').each((index,item) => {
var artist = $(item).parent().parent().parent().find('.m-container__title-bar-item span').text()
var title=$( $(item).find('.m-mtk-track__name') ).text()
var count=$(item).find('.m-mtk-download__count')
var link=$(item).find('.m-mtk-download__links a')
for(var i=0;i<link.length;i++) {
var c=$(count[i]).text().replace(/[^0-9]+/g, '')
df.push({title:title, artist:artist, count:c, size: $(link[i]).text(), link:$(link[i]).attr('href')})
}
})
setTimeout(download("mixing_secrets_audio_tracks_dataset",df),500)
@loretoparisi
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment