小赖子的英国生活和资讯

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

阅读 桌面完整版

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

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

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

欢迎大家围观!

强烈推荐

微信公众号: 小赖子的英国生活和资讯 JustYYUK

阅读 桌面完整版
Exit mobile version