本帖最后由 傲雪不傲霜 于 2023-4-16 14:30 编辑
先在linux系统配置好发件邮箱(或者在windows配置好邮箱并更换发送邮箱命令),再在abc处输入想要获取动态更新提醒的用户id,最后在your_email_address填入自己的邮箱即可。在安装收件软件的手机端或提供邮件提醒的微信公众号即可获得动态更新提示。
[Python] 纯文本查看 复制代码 import cloudmusic
import os, time, smtplib, socket, sys
def comparedict(ca,cb):
c=[]
for ci in cb:
if ca[ci]!=cb[ci]:
c.append(ci)
return(c)
a=cloudmusic.getUser(111111111)
b=cloudmusic.getUser(222222222)
c=cloudmusic.getUser(333333333)
your_email_address=...@...com
mid=[a,b,c]
countmap0={}
for i in mid:
countmap0[i.nickname]=i.eventCount
time.sleep(5)
print(countmap0)
countmap={}
for timestep in range(10):
for i in mid:
countmap[i.nickname]=i.eventCount
time.sleep(1)
a=cloudmusic.getUser(111111111)
b=cloudmusic.getUser(222222222)
c=cloudmusic.getUser(333333333)
mid=[a,b,c]
print('timestep=%d %s'%(timestep,countmap))
if timestep==0:
os.system('echo "This email is from 52pojie, have fun!" | mail -s "Now starts cm(py)." %s'%your_email_address)
elif timestep==28800000000:
os.system('echo "This email is from 52pojie, have fun!" | mail -s "Program cm(py) ended." %s'%your_email_address)
elif timestep%720==0:
print('timestep=%d %s'%(timestep,countmap))
else:
if comparedict(countmap0,countmap)!=[]:
updater=comparedict(countmap0,countmap)[0]
os.system('echo "This email is from 52pojie, have fun!" | mail -s "%supdated!" %s'%(updater,your_email_address))
sentence='%s'%updater+' updated dynamics.'
print(sentence)
for i in mid:
countmap0[i.nickname]=i.eventCount
time.sleep(1)
time.sleep(10) |