Created
February 24, 2024 14:42
-
-
Save slamer59/5bcf51514ade0a264868ef757e52696b to your computer and use it in GitHub Desktop.
Extract All Album from Deezer and chrome console
This file contains hidden or 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
// Initialize CSV string with headers | |
let csvContent = "Track,Artist,Album\n"; | |
// Select all elements with the class name "JR0qJ" | |
const elements = document.querySelectorAll('.JR0qJ'); | |
// Loop through each element | |
elements.forEach(trackElement => { | |
// Extract track, artist, and album information | |
const track = trackElement.querySelector('[data-testid="title"]').textContent.trim(); | |
const artist = trackElement.querySelector('[data-testid="artist"]').textContent.trim(); | |
const album = trackElement.querySelector('[data-testid="album"]').textContent.trim(); | |
// Append extracted information to CSV string | |
csvContent += `"${track}","${artist}","${album}"\n`; | |
}); | |
// Create a Blob object with the CSV content | |
const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' }); | |
// Create a temporary URL for the Blob object | |
const url = URL.createObjectURL(blob); | |
// Create a link element | |
const link = document.createElement("a"); | |
link.setAttribute("href", url); | |
link.setAttribute("download", "track_artist_album.csv"); | |
// Append the link to the document body and trigger a click event to start the download | |
document.body.appendChild(link); | |
link.click(); | |
// Clean up by revoking the temporary URL | |
URL.revokeObjectURL(url); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment