4

I have posted some questions in the SciFi&Fantasy Beta and somebody has favored one of them. Can I see who is that person?

  • If you no mean up-vote, no you can't. Also questions about how the stack-exchange sites work, belong on meta.stackoverflow.com, I believe. – Mark Rogers Feb 23 '11 at 4:13
1

You can do this via the StackExchange API. However, I think the only way to do it is backwards - you can see what each user's favourites are, but not who favourited each question, so you'd have to loop through all users until you found sufficient matches to get the answer.

(This is not a great use of the API - if there's a legitimate use for doing this, then a request to add a /questions/{ids}/favorite to the API would be better. API requests without an API key are also limited, so doing this may not be feasible without one, even on a small site like this).

For example, this link gives you (in JSON) my favourites, as I am user 108 (it's empty, as I have no favourites here), and this link gives you user 9's favourites.

To find the answer, you'd do something like this:

for i in range(1, total_users+1):
    compressed_data = StringIO.StringIO(urllib2.urlopen("http://api.scifi.stackexchange.com/1.1/users/%s/favorites" % i).read())
    data = json.loads(gzip.GzipFile(fileobj=compressed_data).read())
    for question in data["questions"]:
        if question["question_id"] == desired_question:
            print "Favourited by user:", i
            return              
  • Curious about the downvote - does someone believe that this is not possible? I did verify it first. Or is it just because this isn't a great way to use the API? I did point that out, but it's still a correct answer to the question (and it works during beta, unlike the SEDE). – Tony Meyer Feb 23 '11 at 9:48
  • The link you have provided at the end of your answer only shows the following: { "total": 0, "page": 1, "pagesize": 30, "questions": [] } – Darius Feb 23 '11 at 19:10
  • @darius I've edited so that it's clearer that this does indeed work. – Tony Meyer Feb 23 '11 at 20:21
2

You can do this with a Stack Exchange Data Explorer (SEDE) Query (I'd give you a link, but I'm having trouble logging into it right now):

-- Who Favorited My Question?
-- Show users who marked a as "favorites", and which posts they marked...

DECLARE @PostID int = ##PostID##

select votes.userid as [User Link], posts.id as [Post Link] from votes join posts on posts.id = votes.postid where votetypeid=5 and posts.id=@PostID​

However, there is no data in SEDE on Stack Exchange sites in beta. When SciFi.SE goes live, you'll be able to use the above to find out.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .