Last active
September 15, 2021 19:36
-
-
Save ed-cooper/bb561eadad84a6d8c116ed0e97358717 to your computer and use it in GitHub Desktop.
Returns all the followers of the Scratch user
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script type="text/javascript" src='http://code.jquery.com/jquery-latest.min.js'> | |
</script> | |
<script> | |
// Original code by @griffpatch ( https://scratch.mit.edu/users/griffpatch/ ) | |
var username = "chooper100"; // Replace with your username | |
var page = 1; | |
function load(e) { | |
$.get("https://scratch.mit.edu/users/" + username + "/followers/?page=1", loaded); | |
} | |
function loaded(data) { | |
var $dom = $(data); | |
var $users = $dom.find('span.title').children(); | |
var $out = $('#result'); | |
for (var i=0; i < $users.length; i++) { | |
var user = $users[i].text.trim(); | |
$out.prepend(user + '<br>'); | |
} | |
page++; | |
$.get("https://scratch.mit.edu/users/" + username + "/followers/?page=" + page, loaded); | |
} | |
</script> | |
</head> | |
<body onload="load(event);"> | |
<div id='result'></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hi