Skip to content

Instantly share code, notes, and snippets.

@ryanbrink
Created July 28, 2015 20:23
Show Gist options
  • Save ryanbrink/d6213cdffc8bcb0aab6e to your computer and use it in GitHub Desktop.
Save ryanbrink/d6213cdffc8bcb0aab6e to your computer and use it in GitHub Desktop.
// 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);
};
@ryanbrink
Copy link
Author

Just put in your Product Hunt access token and the post ID you're interested in!

@ryanbrink
Copy link
Author

You can get your own access token here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment