微信的消息内容
消息內容
微信一般消息內容
{"FromUserName": "","ToUserName": "","Content": "","StatusNotifyUserName": "","ImgWidth": 0,"PlayLength": 0,"RecommendInfo": {},"StatusNotifyCode": 0,"NewMsgId": "","Status": 0,"VoiceLength": 0,"ForwardFlag": 0,"AppMsgType": 0,"Ticket": "","AppInfo": {},"Url": "","ImgStatus": 0,"MsgType": 0,"ImgHeight": 0,"MediaId": "","MsgId": "","FileName": "","HasProductId": 0,"FileSize": "","CreateTime": 0,"SubMsgType": 0 }微信回復的所有消息都遵循這一格式,下面將就每種消息類型具體分析。
消息的具體內容
本段部分參考Urinx的Github并修改。
微信初始化消息
MsgType: 51 FromUserName: 自己ID ToUserName: 自己ID StatusNotifyUserName: 最近聯系的聯系人ID Content:<msg><op id='4'><username># 最近聯系的聯系人filehelper,xxx@chatroom,wxid_xxx,xxx,...</username><unreadchatlist><chat><username># 朋友圈MomentsUnreadMsgStatus</username><lastreadtime>1454502365</lastreadtime></chat></unreadchatlist><unreadfunctionlist># 未讀的功能賬號消息,群發助手,漂流瓶等</unreadfunctionlist></op></msg>文本消息
MsgType: 1 FromUserName: 發送方ID ToUserName: 接收方ID Content: 消息內容圖片消息
MsgType: 3 FromUserName: 發送方ID ToUserName: 接收方ID MsgId: 用于獲取圖片 Content:<msg><img length="6503" hdlength="0" /><commenturl></commenturl></msg>itchat添加了Text鍵,鍵值為下載該圖片的方法。
小視頻消息
MsgType: 62 FromUserName: 發送方ID ToUserName: 接收方ID MsgId: 用于獲取小視頻 Content:<msg><img length="6503" hdlength="0" /><commenturl></commenturl></msg>itchat添加了Text鍵,鍵值為下載該視頻的方法。
地理位置消息
MsgType: 1 FromUserName: 發送方ID ToUserName: 接收方ID Content: http://weixin.qq.com/cgi-bin/redirectforward?args=xxxitchat添加了Text鍵,鍵值為該地點的文本形式。
名片消息
MsgType: 42 FromUserName: 發送方ID ToUserName: 接收方ID Content:<?xml version="1.0"?><msg bigheadimgurl="" smallheadimgurl="" username="" nickname="" shortpy="" alias="" imagestatus="3" scene="17" province="" city="" sign="" sex="1" certflag="0" certinfo="" brandIconUrl="" brandHomeUrl="" brandSubscriptConfigUrl="" brandFlags="0" regionCode="" />RecommendInfo:{"UserName": "xxx", # ID"Province": "xxx", "City": "xxx", "Scene": 17, "QQNum": 0, "Content": "", "Alias": "xxx", # 微信號"OpCode": 0, "Signature": "", "Ticket": "", "Sex": 0, # 1:男, 2:女"NickName": "xxx", # 昵稱"AttrStatus": 4293221, "VerifyFlag": 0}itchat添加了Text鍵,鍵值為該調用add_friend需要的屬性。
語音消息
MsgType: 34 FromUserName: 發送方ID ToUserName: 接收方ID MsgId: 用于獲取語音 Content:<msg><voicemsg endflag="1" cancelflag="0" forwardflag="0" voiceformat="4" voicelength="1580" length="2026" bufid="216825389722501519" clientmsgid="49efec63a9774a65a932a4e5fcd4e923filehelper174_1454602489" fromusername="" /></msg>itchat添加了Text鍵,鍵值為下載該語音文件的方法。
動畫表情
MsgType: 47 FromUserName: 發送方ID ToUserName: 接收方ID Content:<msg><emoji fromusername = "" tousername = "" type="2" idbuffer="media:0_0" md5="e68363487d8f0519c4e1047de403b2e7" len = "86235" productid="com.tencent.xin.emoticon.bilibili" androidmd5="e68363487d8f0519c4e1047de403b2e7" androidlen="86235" s60v3md5 = "e68363487d8f0519c4e1047de403b2e7" s60v3len="86235" s60v5md5 = "e68363487d8f0519c4e1047de403b2e7" s60v5len="86235" cdnurl = "http://emoji.qpic.cn/wx_emoji/eFygWtxcoMF8M0oCCsksMA0gplXAFQNpiaqsmOicbXl1OC4Tyx18SGsQ/" designerid = "" thumburl = "http://mmbiz.qpic.cn/mmemoticon/dx4Y70y9XctRJf6tKsy7FwWosxd4DAtItSfhKS0Czr56A70p8U5O8g/0" encrypturl = "http://emoji.qpic.cn/wx_emoji/UyYVK8GMlq5VnJ56a4GkKHAiaC266Y0me0KtW6JN2FAZcXiaFKccRevA/" aeskey= "a911cc2ec96ddb781b5ca85d24143642" ></emoji> <gameext type="0" content="0" ></gameext></msg>itchat添加了Text鍵,鍵值為下載該圖片表情的方法。
由于版權問題,部分微信商店提供的表情是無法下載的,注意。
普通鏈接或應用分享消息
MsgType: 49 AppMsgType: 5 FromUserName: 發送方ID ToUserName: 接收方ID Url: 鏈接地址 FileName: 鏈接標題 Content:<msg><appmsg appid="" sdkver="0"><title></title><des></des><type>5</type><content></content><url></url><thumburl></thumburl>...</appmsg><appinfo><version></version><appname></appname></appinfo></msg>音樂鏈接消息
MsgType: 49 AppMsgType: 3 FromUserName: 發送方ID ToUserName: 接收方ID Url: 鏈接地址 FileName: 音樂名AppInfo: # 分享鏈接的應用{Type: 0, AppID: wx485a97c844086dc9}Content:<msg><appmsg appid="wx485a97c844086dc9" sdkver="0"><title></title><des></des><action></action><type>3</type><showtype>0</showtype><mediatagname></mediatagname><messageext></messageext><messageaction></messageaction><content></content><contentattr>0</contentattr><url></url><lowurl></lowurl><dataurl>http://ws.stream.qqmusic.qq.com/C100003i9hMt1bgui0.m4a?vkey=6867EF99F3684&guid=ffffffffc104ea2964a111cf3ff3edaf&fromtag=46</dataurl><lowdataurl>http://ws.stream.qqmusic.qq.com/C100003i9hMt1bgui0.m4a?vkey=6867EF99F3684&guid=ffffffffc104ea2964a111cf3ff3edaf&fromtag=46</lowdataurl><appattach><totallen>0</totallen><attachid></attachid><emoticonmd5></emoticonmd5><fileext></fileext></appattach><extinfo></extinfo><sourceusername></sourceusername><sourcedisplayname></sourcedisplayname><commenturl></commenturl><thumburl>http://imgcache.qq.com/music/photo/album/63/180_albumpic_143163_0.jpg</thumburl><md5></md5></appmsg><fromusername></fromusername><scene>0</scene><appinfo><version>29</version><appname>搖一搖搜歌</appname></appinfo><commenturl></commenturl></msg>群消息
MsgType: 1 FromUserName: @@xxx ToUserName: @xxx Content:@xxx:<br/>xxxitchat增加了三個群聊相關的鍵值:
* isAt: 判斷是否@本號
* ActualNickName: 實際NickName
* Content: 實際Content
紅包消息
MsgType: 49 AppMsgType: 2001 FromUserName: 發送方ID ToUserName: 接收方ID Content: 未知系統消息
MsgType: 10000 FromUserName: 發送方ID ToUserName: 自己ID Content:"你已添加了 xxx ,現在可以開始聊天了。""如果陌生人主動添加你為朋友,請謹慎核實對方身份。""收到紅包,請在手機上查看"總結
- 上一篇: 云数据库搭建
- 下一篇: windows远程连接redis