Created
May 8, 2020 15:51
-
-
Save esin/89dd3eed4ec9eb29a4ed15ff25d088ee to your computer and use it in GitHub Desktop.
Get GitHub forks
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
var xhr = new XMLHttpRequest(); | |
xhr.responseType = "json"; | |
xhr.open('GET', "https://api.github.com/repos/iBotPeaches/Apktool/forks", true); | |
xhr.send(); | |
xhr.onreadystatechange = processRequest; | |
function processRequest(e) { | |
if (xhr.readyState == 4 && xhr.status == 200) { | |
var forks = xhr.response; | |
forks.forEach(function(fork){ | |
var commitsUrl = fork.commits_url; | |
if (commitsUrl.indexOf('{') > 0) { | |
commitsUrl = commitsUrl.substring(0, commitsUrl.indexOf('{')); | |
} | |
var xhrFork = new XMLHttpRequest(); | |
xhrFork.responseType = "json"; | |
xhrFork.open('GET', commitsUrl, true); | |
xhrFork.send(); | |
xhrFork.onreadystatechange = function(e){ | |
if (xhrFork.readyState == 4 && xhrFork.status == 200) { | |
var commits = xhrFork.response; | |
console.log(commitsUrl, commits[0].commit.committer.date); | |
} | |
}; | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment