mikeizbicki / cmc-csci040

Computing for the Web
37 stars 58 forks source link

Question about Upvote Tallying #292

Closed henrylong612 closed 1 year ago

henrylong612 commented 1 year ago

Hi Mike,

I have been using the following code to tally upvotes and the comment.scores values never seem to be up-to-date with what Reddit actually has. Is this a problem on my end or can I assume that this is an issue with Reddit updating?

-Henry

number_of_upvotes=0
        most_upvoted_comments_without_replies=[]
        for comment in comments_without_replies:
            if comment.score>number_of_upvotes:
                most_upvoted_comments_without_replies=[comment]
                number_of_upvotes=comment.score
            elif comment.score==number_of_upvotes:
                most_upvoted_comments_without_replies.append(comment)
mikeizbicki commented 1 year ago

Short answer: It's expected behavior, and not something to worry about.

Long answer: Reddit never displays raw upvote values (either on the webpage or through the PRAW API). Instead, they always add a small amount of noise to the score value and give you that. The reason for this is that different accounts have their upvotes weighted differently (bot accounts have weights less than 1, and "superuser" accounts have weights > 1), and they don't want people to be able to figure out what their weight is.