点赞机器人每日点赞记录整合到每日报表中! Good-content Upvoting History now Integrated into to Daily Ranking Table

前几天:A Good-Content-Upvote-Bot - CN 区优质内容点赞机器人上线了!, 观察了一两天,觉得还行,于是把部分点赞的记录也公布到每日榜单更新中。

Recording upvote history...
处理记录的Python代码

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:
然后存成文件:

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社区创造出更高质的文章!

欢迎大家围观


Originally published at https://steemit.com Thank you for reading my post, feel free to Follow, Upvote, Reply, ReSteem (repost) @justyy which motivates me to create more quality posts.

原文首发于 https://Steemit.com 首发。感谢阅读,如有可能,欢迎Follow, Upvote, Reply, ReSteem (repost) @justyy 激励我创作更多更好的内容。

// Later, it will be reposted to my blogs: justyy.com, helloacm.com and codingforspeed.com 稍后同步到我的中文博客和英文计算机博客

近期热贴

Recent Popular Posts


Tags: cn cn-programming programming python upvote

H2
H3
H4
3 columns
2 columns
1 column
7 Comments