github littlecodersh/ItChat v1.2.31
增加了图片后缀自动判断

latest releases: v1.3.10, v1.3.9, v1.3.8...
7 years ago

获取用户头像:

import itchat, shutil

itchat.auto_login(True)

r = itchat.get_head_img(picDir='tmp.unknown')
print(r)
if 'PostFix' in r:
    shutil.move('tmp.unknown', 'tmp.%s' % r['PostFix'])

获取聊天图片:

import itchat, shutil

itchat.auto_login(True)

@itchat.msg_register(itchat.content.PICTURE)
def download(msg):
    r = msg['Text']('tmp.unknown')
    print(r)
    if 'PostFix' in r:
        shutil.move('tmp.unknown', 'tmp.%s' % r['PostFix'])

itchat.run()

Don't miss a new ItChat release

NewReleases is sending notifications on new releases.