A question motivated by narcissism:
Is there some way I can find out the total number of upvotes I have received on my comments?
Similarly, can I somehow get a list of all of my comments sorted by their number of votes?
A question motivated by narcissism:
Is there some way I can find out the total number of upvotes I have received on my comments?
Similarly, can I somehow get a list of all of my comments sorted by their number of votes?
You can also query the live site's API for your results:
For the current Stack Exchange API 2.2:
Those have been valid for the outdated version 1.1 of the API:
Replace the number after "users" with your user id on the appropriate site.
You can find out in the data explorer; the data is updated every other month.
and for comparison:
That's one of the more popular queries on data.stackexchange.com: My Comment score distribution. It is not as real-time as you might like though.
Building on Rick Sladkey's answer, I threw a quick Python webserver together so you can see a nice formatted list of a user's top comments.
Note that this is really rough (does zero error checking), but seems to work just fine. Much easier than groking JSON.
Just run it and go to http://localhost:8000/119527
import sys, urllib2, zlib, json
import BaseHTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
MIN = 5
def get_json(url):
u = urllib2.urlopen(url)
gzipped = u.read()
data = zlib.decompress(gzipped, 16+zlib.MAX_WBITS)
return json.loads(data)
def get_username(uid):
d = get_json('http://api.stackoverflow.com/1.1/users/{0}'.format(uid))
return d['users'][0]['display_name']
def do_comments_html(uid, r):
d = get_json('http://api.stackoverflow.com/1.1/users/{0}/comments?sort=votes&min={1}'.format(uid, MIN))
r.write('<html>\r\n')
r.write('<head><title>SO Comments</title></head>\r\n')
r.write('<body>\r\n')
name = get_username(uid)
r.write('<h3>{0} has {1} comments with >= {2} votes. Here are the top {3}</h3>\r\n'.format(
name, d['total'], MIN, min(MIN,d['pagesize'])) )
r.write('<ul>\r\n')
for c in d['comments']:
url = 'http://stackoverflow.com/posts/comments/{0}'.format(c['comment_id'])
r.write('<li> <a href="{0}" target="_blank">[{1}]</a> {2}</li>\r\n'.format(url, c['score'], c['body']))
r.write('</ul>\r\n')
r.write('</body>\r\n</html>\r\n')
class MyHandler(BaseHTTPServer.BaseHTTPRequestHandler):
#Handler for the GET requests
def do_GET(self):
parts = self.path.split('/')
if len(parts) != 2:
self.send_error(404, 'Bad URL')
return
try:
uid = int(parts[1])
except ValueError:
self.send_error(404, 'Bad user id')
return
print 'UID:', uid
mimetype = 'text/html'
self.send_response(200)
self.send_header('Content-type', mimetype)
self.end_headers()
do_comments_html(uid, self.wfile)
if sys.argv[1:]:
port = int(sys.argv[1])
else:
port = 8000
server_address = ('127.0.0.1', port)
httpd = BaseHTTPServer.HTTPServer(server_address, MyHandler)
sa = httpd.socket.getsockname()
print "Serving HTTP on", sa[0], "port", sa[1], "..."
try:
httpd.serve_forever()
except KeyboardInterrupt:
print 'Closing server.'
httpd.socket.close()