During development of my StackUnderflow script I spotted possible bug in SO markup. In my script I need to evaluate user reputation so I look for user-details
<div>
to get it. And this <div>
usually looks like this:
<div class="user-details">
<a href="/users/......./foo">foo</a><br>
<span class="reputation-score" title="reputation score 1234" dir="ltr">1,2k</span><span title="4 bronze badges"><span class="badge3"></span><span class="badgecount">4</span></span>
</div>
in this case, user currently named foo
holds reputation score of 1234
. If your script needs to figure out user reputation you should rely on the title
attribute which is always in "raw" numeric form (i.e, 2000
), not the span text, which is formatted string (i.e. "2k"). So I try to reach this title
thing and figured out that for some users it does not contain reputation score, however it looks like it should. In markup it looks like this:
<div class="user-details">
<a href="/users/4712527/siva">siva</a><br>
<span class="reputation-score" title="reputation score " dir="ltr">5</span><span title="4 bronze badges"><span class="badge3"></span><span class="badgecount">4</span></span>
</div>
note title="reputation score "
- reputation "raw" score is completely missing, yet there's trailing space, so it looks reputation score should be there.
Another reputation related bug (again, I am talking about SO) lurks in part that holds my own reputation. The markup looks like this:
<span class="reputation" title="your reputation: 32,479">
32,479
</span>
Please take a look at title
attribute - it reads 32,479
instead of expected: 32479
. I also consider this a bug as content of title
attribute should stay consistent.
If it is a feature, not a bug, I am open to hear why so :)
EDIT
On User profile reputation looks even worse - title
attribute reads reputation
not reputation score
, there no raw score in title
, score is formatted the same way "my reputation" on "top bar", so "k" but with coma. There's bunch of spaces around too.
<div class="reputation" title="reputation">
32,504 <span class="label-uppercase">reputation</span>
</div>