Last active
April 21, 2025 21:29
-
-
Save DerekParry/13d317b8acf13486978f5c85e245350d to your computer and use it in GitHub Desktop.
Scrape SoundCloud Likes in spreadsheet format
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
| /* | |
| Derek Parry, March 2018 | |
| JS script I use to scrape my SoundCloud Likes in a format that works well with spreadsheets | |
| Instructions: | |
| 1. Log into your SoundCloud account at https://soundcloud.com | |
| 2. Navigate to your Likes at https://soundcloud.com/you/likes | |
| 3. Open your browser's console for this page | |
| 4. Paste the code below | |
| 5. Hit 'Enter' and wait for the results | |
| */ | |
| var scrollToBottom = function() { | |
| var prevHeight = 0; | |
| var interval = setInterval(function () { | |
| prevHeight = document.body.scrollHeight; | |
| window.scrollTo(0, prevHeight); | |
| if(document.body.scrollHeight > prevHeight) { | |
| clearInterval(interval); | |
| } | |
| }, 2500); | |
| }; | |
| var insertJQuery = function() { | |
| var script = document.createElement('script'); | |
| script.src = "https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"; | |
| document.getElementsByTagName('head')[0].appendChild(script); | |
| }; | |
| var outputLikes = function() { | |
| var separator = '\t'; | |
| var results = ['User' + separator + 'Track' + separator + 'URL']; | |
| $(".badgeList__item").each( | |
| function() { | |
| var user = $(this).find(".playableTile__usernameHeadingContainer").first().text(); | |
| var track = $(this).find(".playableTile__descriptionContainer a").first(); | |
| var trackTitle = $.trim(track.text()); | |
| var trackUrl = track[0].href; | |
| var record = $.trim(user) + separator + trackTitle + separator + trackUrl; | |
| results.push(record); | |
| }); | |
| console.log(results.join('\n')); | |
| }; | |
| try { | |
| scrollToBottom(); | |
| insertJQuery(); | |
| setTimeout(function() { outputLikes(); }, 3000); | |
| } | |
| catch(err) { | |
| console.log("Error while scraping data!\n" + err.message); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment