Good-content Upvoting History now Integrated into to Daily Ranking Table.
前几天: A Good-Content-Upvote-Bot – CN 区优质内容点赞机器人上线了! , 观察了一两天, 觉得还行, 于是把部分点赞的记录也公布到每日榜单更新中.
Recording upvote history…
处理记录的Python代码:
1 2 3 4 5 6 7 | ts = time.strftime("%Y-%m-%d %H:%M:%S") msg = "| " + ts msg += "| @" + author + " | [" + title + "](https://steemit.com/" + url + ") " msg += "| " + str("{:.2f}".format(score)) msg += "| " + str("{:.2f}".format(vp)) + "|" if vote(y, account[y], url, score) != False: content += msg + "\n" |
ts = time.strftime("%Y-%m-%d %H:%M:%S") msg = "| " + ts msg += "| @" + author + " | [" + title + "](https://steemit.com/" + url + ") " msg += "| " + str("{:.2f}".format(score)) msg += "| " + str("{:.2f}".format(vp)) + "|" if vote(y, account[y], url, score) != False: content += msg + "\n"
The code saving messages to file:
然后存成文件:
1 2 3 4 5 6 7 8 9 | if len(content) > 1: try: filename = "steem/upvote-hisotry/" + today + ".txt" text_file = open(filename, "a") text_file.write(content) except: print('Error: ' + filename) finally: text_file.close() |
if len(content) > 1: try: filename = "steem/upvote-hisotry/" + today + ".txt" text_file = open(filename, "a") text_file.write(content) except: print('Error: ' + filename) finally: text_file.close()
最后面在生成报表的时候只需要读相应的文件记录即可, 由于每天UTC 正午12点左右生成报告, 所以点赞记录只是当天12小时的记录, 所以是部分点赞记录.
我每天都会生成这个报表, 每天都会人工审核, 并不断调整参数, 尽量达到更好的效果. 毕竟做这事的初衷就是激励CN社区创造出更高质的文章!
欢迎大家围观!
GD Star Rating
loading...
本文一共 185 个汉字, 你数一下对不对.loading...
上一篇: 带孩子参观消防车 Cambridge Fire Station Open Day
下一篇: 信上帝, 有饭吃. Hymns of Life
扫描二维码,分享本文到微信朋友圈