Last active
August 16, 2023 17:58
-
-
Save loretoparisi/3676d1471e25964c490d4b418f06ed6f to your computer and use it in GitHub Desktop.
Sanremo Music Festival Tracks Dataset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} | |
const title = $('.firstHeading').text().replace(/[aA-zZ]/g,'').trim(); | |
const table = $('.wikitable').length - 1; | |
const dataset = $($('.wikitable')[table]).find('tr').slice(1).map((index,item) => { | |
return { | |
track_year: title, | |
track_id: index, | |
track_pos: $($(item).find('td')[0]).text().trim().replace(/[°º]/,''), | |
artist_name: $($(item).find('td')[1]).text().trim(), | |
track_name: $($(item).find('td')[2]).text().trim(), | |
track_writers: $($(item).find('td')[3]).text().trim(), | |
track_votes: $($(item).find('td')[4]).text().trim() | |
}; | |
}).toArray() | |
download(title,dataset) |
Please give me the full dataset in .csv, thanks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
1984-2003