Created
July 28, 2015 20:23
-
-
Save ryanbrink/d6213cdffc8bcb0aab6e to your computer and use it in GitHub Desktop.
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
// This is a dead-simple script that simply logs the usernames of the people who have updated a post, ordered by when they voted | |
var access_token = "YOUR_TOKEN"; | |
var post_id = "POST_ID"; | |
var theUrl = "https://api.producthunt.com/v1/posts/"+post_id+"/votes?access_token=" + access_token | |
var xmlHttp = new XMLHttpRequest(); | |
xmlHttp.open( "GET", theUrl, false ); | |
xmlHttp.send( null ); | |
votes = JSON.parse(xmlHttp.responseText).votes; | |
votes.sort(function(a, b) { if (Date.parse(a.created_at) < Date.parse(b.created_at)) {return -1}; return 1; } ) | |
for(i = 0; i < votes.length; i++) { | |
console.log(votes[i].created_at + " " + votes[i].user.username); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just put in your Product Hunt access token and the post ID you're interested in!