点赞机器人每日点赞记录整合到每日报表中


Good-content Upvoting History now Integrated into to Daily Ranking Table.

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

voting-history 点赞机器人每日点赞记录整合到每日报表中 I.T. SteemIt 程序设计

voting-history

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 个汉字, 你数一下对不对.
点赞机器人每日点赞记录整合到每日报表中. (AMP 移动加速版本)
上一篇: 带孩子参观消防车 Cambridge Fire Station Open Day
下一篇: 信上帝, 有饭吃. Hymns of Life

扫描二维码,分享本文到微信朋友圈
c83bfb0b2e84e1e47eae4bbea3229e2a 点赞机器人每日点赞记录整合到每日报表中 I.T. SteemIt 程序设计

评论