给"Steemit好友微信群"做了个排行榜

in #cn7 years ago (edited)

hb-mertz-314528.jpg

缘起

进到 Steemit 是被 @tumutanzi 推荐的, 注册成功的当天就发了封邮件, 想加入他建的微信群. 印象里他有提过要做一个微信群好友名录, 正好旅游前这几天事情不多, 花了点时间用 Python 折腾了一个名单发了过去.

发完名单就突然想到了上一篇文章里面用来处理排行榜的代码, 想想如果给群里好友来个排行呢? 上一篇文章碍于篇幅就没输出全部中文区的排名, 而真正尝试者又寥寥无几(这里要赞一下 @zsilence 的行动力). 光说不练假把式, 实战演习一下好了, 给群友做点福利.

思路

有了昨天的代码基础, 其实只要搞到要计算的排名名单就好了, 把它作为 authorObjects 变量传到代码里, 其他逻辑基本不用动.
怎么样搞到群排名名单呢? Github 找了找, 发现 nodejs 有 Itchat, python 有 wxpy, 都是还不错的项目. 看了下代码实现, 都还比较容易, 这次决定试试 python.

准备

使用 python 的时候要注意 python 是有两个大分支的, 2.x 和 3.x, 十分精分, 背后有个狗血的撕逼故事, 感兴趣的可以去了解一下, 不在本文的讨论范围. 因为我是蛮早以前就用 python2 的, 所以这次选择 2.7.10, 如果你的本机 python 环境不一样, 请注意 pip 等命令的不同, 这里不做赘述, 有问题请回复.

> python
Python 2.7.10 (default, Feb  7 2017, 00:08:15)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin

如果环境下没有 pip, 需要自行安装一下, 在 mac 上很容易, 直接命令行解决

sudo easy_install pip

由于要使用到 wxpy 库, 所以在你的项目目录下, 先安装一下做准备

pip install wxpy

新建一个 app.py 文件, 作为主项目文件, 备用. 准备要昨天文章里的项目代码. 至此, 准备工作结束, 开始编码.

代码

app.py

#!/usr/bin/python
# -*- coding: utf-8 -*-

from __future__ import print_function
from wxpy import *

bot = Bot()

group = bot.groups().search(unicode('Steemit好友微信群', 'utf-8'))[0]

print("[", end='')

for member in group:
    print("'" + member.name.lower() + "'", end=', ')

print("]")
        
print('==== End ====')

app-wechat.js

...
var authorObjects = [’cnjinbo', 'tumutanzi', ...];    // copy from app.py return value
...

说明

为了让 print 方法在 2.x 下面也支持 end 参数, 要在文件头部加上这句声明

from __future__ import print_function

由于群文件是中文, 我强制转了一下 utf-8, 你也可以试一下不转的结果

group = bot.groups().search(unicode('Steemit好友微信群', 'utf-8'))[0]

最后, 无论 wxpy 也好, Itchat 也好, 都是 hack 的微信的协议, 所以在测试时, 有一定概率会引起微信不适, 请自行拿捏. 我个人试下来还好.

结果

数据来源: https://steemdata.com/
用户范围: Steemit好友微信群

财富榜 (sorted by Estimated Account Value)

Rank.IDValueSTEEMSPSBD
1@sweetsssj110926.461.16367116.30514210.192
2@ace10822999.211147.74812494.8753340.193
3@oflyhigh22403.7118.1315481.35668.952
4@deanliu20115.151135.26511133.3292436.104
5@cqf15548.40010789.6570.506
6@joythewanderer11950.3707482.9671167.415
7@rivalhw11390.8806601.3221878.372
8@myfirst9276.120.456362.307107.389
9@htliao7689.4405332.6595.076
10@jademont7634.001.7215156.003201.721
11@superhardness7395.1105128.7884.529
12@tumutanzi7265.3004983.73683.733
13@coldhair6980.3504810.81247.968
14@wilkinshui6028.35177.6163869.852195.947
15@fundurian5381.252.3063618.424163.778
16@kitcat5310.182.3473109.273826.337
17@justyy5232.680.93437.202278.372
18@linuslee02164513.2203079.83575.178
19@nicolemoker3772.840.0012085768.356
20@dixonloveart3680.76758.5991412.252552.562
21@jubi3602.2401763.1531061.535
22@bxt3041.512.4732107.371.222
23@susanlo2661.780.1011679.988240.776
24@krischy2648.010.0011292.105786.088
25@mrpointp2255.150.0011563.312.414
26@wilsonwei7772107.5501462.4050.227
27@victorier2089.8901398.96873.973
28@aaronli1928.380828.266734.847
29@pakyeechan1864.9501294.2040
30@dapeng1848.4501135.306212.477
31@kenchung1714.5201189.1310.978
32@nationalpark1671.3921.082871.753384.819
33@rollinsoul1643.7101140.6050.097
34@liflorence1632.560901.812333.048
35@incrediblesnow1602.752.16733.377542.844
36@travelgirl1574.280.1641070.70831.154
37@swssmarketing1565.8790.781956.62256.564
38@catwomanteresa1289.2333.902725.091195.519
39@nanosesame1245.941.133769.833134.974
40@peterchen1451206.700.001780.20182.431
41@shenchensucc1142.240.727784.26211.07
42@wnh5185181131.2974.08691.80727.643
43@hannahwu1088.430697.50183.33
44@timknip1016.730375.637475.437
45@mrspointm975.400668.53712.043
46@nuagnorab822.580542.26841.175
47@mellissaying673.190285.356261.992
48@herlife564.700.081391.5130.418
49@tvb491.990186.881222.692
50@bring484.010185.361216.907
51@zsilence415.970197.455131.435
52@zhijun387.510204.03893.487
53@expatkai383.0552.08212.4221.899
54@renzhichu366.630175.556113.651
55@sunnyjolly362.710211.10958.497
56@tensaix2j337.9920.913133.887114.92
57@angelababy335.120.903167.42892.558
58@chaofanjun334.620131.742144.779
59@cornelia325.240.087123.605147.003
60@shirlam305.610103.986155.767
61@wanderwithtwo304.342.042108.106145.621
62@yuxi291.8613.661148.03858.848
63@luojia215.620137.89416.913
64@liangfengyouren197.900137.3250.016
65@icedream176.070121.9930.282
66@benk168.720116.9010.261
67@john811167.780112.9595.008
68@jessicameng166.860109.1649.559
69@terinadx165.096.957.32172.552
70@candiceji126.870.00187.5710.677
71@lymichale113.54063.21522.451
72@syh7758520110.93061.85921.789
73@jiangchen107.42033.76558.767
74@luneknight105.42070.423.946
75@towardsthesun103.35071.7190.004
76@bullda93.323.07461.6830.01
77@ernestine88.51033.50740.223
78@cnjinbo87.99057.8474.632
79@mangoanddaddy86.24048.12116.9
80@shaiya85.40057.1013.121
81@skenan80.76053.5213.639
82@kangnajiang79.73030.08836.369
83@kanxsh62.49023.29528.918
84@larus56.05018.68329.128
85@yunxiaohui54.64021.09924.234
86@colmanlamkh48.34033.1310.6
87@lucyshow45.47016.04822.345
88@sportyfree42.4400.50141.716
89@chinaqf38.88024.982.88
90@lizhangwen32.7400.50132.014
91@aleng29.17015.2577.184
92@hiquanta29.144.8410.7846.621
93@feiyu9326.57018.4390.001
94@shanghairabbit25.1400.50124.414
95@kawaiiiiiiii03024.81017.2170
96@eco01921.63010.8016.061
97@karasui20.13112.9250.068
98@hopsken18.5306.5869.038
99@idd18.3103.3213.524
100@rencircle16.4806.5866.991
101@cyres15.370.5356.5035.231
102@jiba12.4500.50111.732
103@hana11.3707.8930
104@kate10.9707.610
105@mollymolly10.6000.6189.706
106@climax9.2403.4854.214
107@niya8.6506.0010
108@mxg8.65060
109@hqy8.65060
110@watara8.3805.7820.049
111@concrete7.6405.30
112@veronicazhu6.5502.562.86
113@diaohuijun5.5900.5014.873
114@wlcpu4.4900.5013.769
115@xuran3.4700.5662.654
116@purpleyan6413.4100.52.691
117@chunxiao3.2301.441.158
118@aafeng2.8701.6650.47
119@geass2.0801.0060.628
120@sean19802.0400.8670.788
121@hag2281.9800.6121.096
122@artcenter11.810.0990.9130.348
123@ceciliali1.7300.5011.011
124@ecust-leicester0.9800.50.264
125@pptx0.7400.5110
126@leir0.7200.5010.003
127@liumei0.7200.5010
128@chaoyang0.7200.5010
129@baixu10180.7200.5010
130@harbour0.7200.5010
131@haishen0.7200.5010
132@moumouzhu0.7200.5010
133@xiaozi0.7200.5010
134@sh3dowin0.7200.5010
135@yanel0.7200.50
136@erye0.7200.50
137@cnm0.7200.50
138@jack.fhj0.7200.50
139@timelordlulu0.7200.50
140@ljj0.7200.50
141@berlin19970.7200.50
142@helloboy0.7200.50
143@yuan06010.7200.50
144@taozijie0.7200.50
145@syp0.7200.50
146@antone0.7200.50
147@zhoudi12200.7200.50
148@feng19250.7200.50

信誉榜 (sorted by Reputation score)

Rank.IDRepVP(%)OnlineValue
1@sweetsssj74.7782.24393110926.46
2@myfirst72.2430.074049276.12
3@oflyhigh72.278.9840222403.71
4@ace10871.5258.7441022999.21
5@deanliu70.9533.2341320115.15
6@rivalhw69.9866.8539911390.88
7@jademont67.589.154737634.00
8@jubi66.8333.692363602.24
9@justyy66.7864.583765232.68
10@tumutanzi66.2281.443927265.30
11@joythewanderer66.0431.3041211950.37
12@bxt65.0188.662233041.51
13@htliao64.7277.591147689.44
14@kitcat63.8579.33895310.18
15@wilkinshui63.834.40876028.35
16@linuslee021663.7491.17894513.22
17@dixonloveart63.6593.543533680.76
18@coldhair62.9198.001706980.35
19@travelgirl62.5670.00631574.28
20@nicolemoker62.4794.73523772.84
21@liflorence62.4257.18691632.56
22@krischy62.3862.27782648.01
23@hannahwu61.5446.16531088.43
24@pakyeechan61.559.83891864.95
25@susanlo61.2855.631022661.78
26@fundurian61.1483.104145381.25
27@victorier61.1361.80892089.89
28@dapeng61.0698.003211848.45
29@aaronli61.0259.62791928.38
30@kenchung60.6159.25891714.52
31@mrpointp60.5698.00652255.15
32@incrediblesnow60.2391.87691602.75
33@nanosesame59.9436.88901245.94
34@peterchen14559.7298.001061206.70
35@wnh51851859.5761.651021131.29
36@shenchensucc59.3833.51781142.24
37@mrspointm59.2686.5732975.40
38@nationalpark59.277.23781671.39
39@catwomanteresa58.8498.00581289.23
40@timknip58.3296.42691016.73
41@herlife57.8460.6240564.70
42@superhardness57.7480.27547395.11
43@sunnyjolly57.5540.5036362.71
44@bring57.5139.93315484.01
45@mellissaying57.2562.1056673.19
46@tvb56.7231.7837491.99
47@zsilence55.8676.1826415.97
48@zhijun55.2795.33389387.51
49@cornelia55.2694.16156325.24
50@renzhichu55.1213.5921366.63
51@chaofanjun54.9435.3244334.62
52@icedream54.7579.3438176.07
53@shirlam54.4459.0258305.61
54@wanderwithtwo54.479.9258304.34
55@liangfengyouren54.3596.2247197.90
56@swssmarketing54.1849.03641565.87
57@yuxi54.1491.58354291.86
58@angelababy53.8488.1978335.12
59@candiceji53.5898.0038126.87
60@jessicameng53.585.0641166.86
61@tensaix2j53.428.66410337.99
62@luojia53.2798.0041215.62
63@bullda52.9262.811993.32
64@terinadx52.6290.8252165.09
65@nuagnorab52.5760.6989822.58
66@syh775852051.8373.7955110.93
67@cqf51.695.3614415548.40
68@mangoanddaddy51.4398.004486.24
69@shaiya51.3782.324685.40
70@john81151.1596.0438167.78
71@jiangchen51.0394.1245107.42
72@cnjinbo50.9794.175387.99
73@ernestine50.6796.974188.51
74@karasui50.542.293820.13
75@luneknight50.3348.75361105.42
76@lymichale50.2596.0420113.54
77@towardsthesun50.1898.0054103.35
78@colmanlamkh49.9984.566348.34
79@kanxsh49.8694.822962.49
80@veronicazhu49.5496.12146.55
81@sportyfree49.3692.222242.44
82@kangnajiang49.3162.724479.73
83@skenan48.449.033680.76
84@zhoudi122048.1686.8580.72
85@larus47.6396.7839256.05
86@expatkai47.4583.3674383.05
87@chinaqf47.4469.283038.88
88@yunxiaohui47.0896.042554.64
89@berlin199747.0265.2060.72
90@shanghairabbit46.789.704325.14
91@mxg46.3596.1228.65
92@lucyshow46.0898.003845.47
93@kawaiiiiiiii03045.6285.295324.81
94@lizhangwen45.1496.376032.74
95@eco01944.3998.0039721.63
96@mollymolly44.1986.813810.60
97@jiba43.6398.003812.45
98@cyres43.1897.212315.37
99@xuran43.0774.45103.47
100@aleng42.2398.0035829.17
101@hopsken42.2196.133818.53
102@rencircle42.0996.042916.48
103@feng192541.7990.0360.72
104@niya41.2597.2028.65
105@liumei41.0698.00300.72
106@timelordlulu40.2496.6950.72
107@xiaozi39.9698.00210.72
108@climax39.4596.04229.24
109@wlcpu39.0298.00304.49
110@diaohuijun38.9788.16535.59
111@idd38.9398.004118.31
112@watara38.8898.00308.38
113@purpleyan64138.6783.27203.41
114@erye38.298.0020.72
115@aafeng37.7597.86412.87
116@syp36.4584.1120.72
117@antone35.5196.0480.72
118@chunxiao35.0298.00373.23
119@baixu101834.14100.00470.72
120@sean198032.8694.26692.04
121@geass32.7964.89392.08
122@wilsonwei77731.4297.98642107.55
123@leir31.33100.00400.72
124@artcenter131.1898.00761.81
125@ecust-leicester29.5798.00200.98
126@benk29.4999.5086168.72
127@rollinsoul26.4598.00961643.71
128@hag22825.1494.15501.98
129@pptx2598.00270.74
130@concrete2599.243837.64
131@haishen2596.04380.72
132@taozijie25100.0000.72
133@kate25100.0049310.97
134@yuan060125100.0010.72
135@yanel25100.0010.72
136@hana25100.0049411.37
137@cnm25100.00400.72
138@jack.fhj25100.00280.72
139@helloboy25100.00300.72
140@harbour25100.00300.72
141@feiyu9324.3241.63226.57
142@hqy23.7192.5728.65
143@ceciliali16.2298.00381.73
144@chaoyang12.5498.00460.72
145@moumouzhu12.0184.33330.72
146@sh3dowin9.3398.00400.72
147@ljj8.8981.8200.72
148@hiquanta3.5298.004829.14

最后

"Steemit好友微信群"汇聚了中文区很多大牛和众多热心 Steem 人, 欢迎大家联系 @tumutanzi 加入, 这里不负责任的做波小推广.

以及, @niya 是我老婆, 之前这个帐号下的游记都是由她撰写的, 最近她自己的账号终于通过了, 恳请大家关注她, 谢谢!

Sort:  

还不错,就是广告太多,喧宾夺主了。

广告就一个,放在底部,你不拉下去看不到的。那个广告是页面模板里的,所以没有特意加上。

感谢。想加入“Steemit好友微信群”的朋友,请发送邮件给 contact # tumutanzi.com (请替换#号成@符号),告诉我你的微信号,我再拉你入群,这是我目前能拉你入群的唯一办法。

排名88,85,哈哈,数字不错!

非常感谢教我查数据,真是特别棒的教程,简洁明了,很有操作性!

是你的执行力强,给你点赞

感谢您汇集这些数据,这一定帮助到无数的Steemians.
感恩有你!

感谢认可,是 @tumutanzi 组织的好,我是举手之劳。

唉,群名称里有汉字,可惜没有上榜

请按照群通知里的描述,改一下昵称,我回头会再拉一遍数据更新下的:)

更新了通知一下。

我刚才又拉了一遍数据, 这次多检索出了6个人(142->148), 已经更新上去了.
刚才和大鹏聊了一下, 准备做一个动态的, 我回头看看他那边进展.

不错,在自己的网页上更新就能控制了,Steemit上的话,7天之后就无法更新了。

声明一下,我直到现在才看到这条评论知道你们之前讨论要做。。。我要是之前看到你们讨论要做,那我就不会做这个了。。

感谢!终于可以在一个排行榜里面露个脸了

荣幸上榜!多谢!

不错的排行

我还没搞明白steemit怎么玩,哈哈哈哈

Coin Marketplace

STEEM 0.22
TRX 0.26
JST 0.040
BTC 98083.48
ETH 3476.77
USDT 1.00
SBD 3.24