Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No title or URL found in TYPE_LINK; exception str() failed #52

Open
ajburley opened this issue Dec 27, 2017 · 8 comments
Open

No title or URL found in TYPE_LINK; exception str() failed #52

ajburley opened this issue Dec 27, 2017 · 8 comments

Comments

@ajburley
Copy link

ajburley commented Dec 27, 2017

Due to #51, I modified "dump-html.py" to remove the try block and instead accept chatid directly from args. Not sure if this will actually work. Following this, I am getting another issue when running "dump-html.py". See below image:

ubuntu server_27_12_2017_13_48_42

WeChat version: 6.3.27

Not sure if this is due to the change I made (see #51) or some other reason.

You can also see that the contact name comes up with diamonds in the name, this is also due to my terminal not being able to render those special characters; see paragraph at the top of #51.

@ppwwyyxx
Copy link
Owner

Changing the name is fine. This error might be due to some format change in wechat. I couldn't get this error myself, but it may help if you could print self.content_xml_ready before the assertion line.

@ajburley
Copy link
Author

I think I found the offending row, at least the first one. The row appears to be a sticker sent using "WeChatSticker". I will paste some values here; later I will add a screenshot of how it appears on the phone.

type = 49 (obviously)
createTime = 1404895676000 (this message was sent during 2014, so it's unlikely to be a format change, probably just a use-case you haven't seen before)
imgPath = THUMBNAIL_DIRPATH://th_033a654396173a9c05aabb14ccb859b4
status = 2
lvBuffer is a 38-byte blob with just { and then loads of zero bytes and then }

content:
<msg><appmsg appid="wx03ac32a3c1abfd1a" sdkver="0"><title></title><des>It&apos;s like me in my little tent :)</des><action>view</action><type>7</type><showtype>0</showtype><content></content><url></url><lowurl></lowurl><dataurl></dataurl><lowdataurl></lowdataurl><appattach><totallen>0</totallen><attachid></attachid><emoticonmd5></emoticonmd5><fileext></fileext></appattach><extinfo>{&quot;mAnimationData&quot;:{&quot;descs&quot;:{&quot;zh_rcn&quot;:&quot;It\u0027s like me in my little tent :)&quot;},&quot;titles&quot;:{&quot;zh_tw&quot;:&quot;温暖的港湾&quot;,&quot;zh_hk&quot;:&quot;温暖的港湾&quot;,&quot;en&quot;:&quot;Warm haven&quot;,&quot;zh_rcn&quot;:&quot;温暖的港湾&quot;},&quot;mTitle&quot;:&quot;温暖的港湾&quot;,&quot;mDesc&quot;:&quot;It\u0027s like me in my little tent :)&quot;,&quot;newFlag&quot;:true,&quot;mCreateDate&quot;:1386646361,&quot;id&quot;:32,&quot;mPrice&quot;:0,&quot;mScreenOrientationType&quot;:2,&quot;mIsFullScreenMode&quot;:false,&quot;categoryId&quot;:7,&quot;mFavoriteCount&quot;:2551426},&quot;mIsBuiltIn&quot;:false,&quot;mMinVerCodeNeed&quot;:1,&quot;msg&quot;:&quot;ok&quot;,&quot;code&quot;:0}</extinfo><androidsource>1</androidsource><thumburl></thumburl><mediatagname></mediatagname><messageaction><![CDATA[]]></messageaction><messageext><![CDATA[]]></messageext><emoticongift><packageflag>0</packageflag><packageid></packageid></emoticongift><emoticonshared><packageflag>0</packageflag><packageid></packageid></emoticonshared></appmsg></msg>

reserved:
~SEMI_XML~��.msg.appmsg.des�!It's like me in my little tent :)��.msg.appmsg.type��7��.msg.appmsg.showtype��0��.msg.appmsg.$sdkver��0�$.msg.appmsg.emoticongift.packageflag��0��.msg.appmsg.androidsource��1��.msg.appmsg.appattach.totallen��0��.msg.appmsg.$appid��wx03ac32a3c1abfd1a��.msg.appmsg.extinfo�Ƴ{"mAnimationData":{"descs":{"zh_rcn":"It\u0027s like me in my little tent :)"},"titles":{"zh_tw":"温暖的港湾","zh_hk":"温暖的港湾","en":"Warm haven","zh_rcn":"温暖的港湾"},"mTitle":"温暖的港湾","mDesc":"It\u0027s like me in my little tent :)","newFlag":true,"mCreateDate":1386646361,"id":32,"mPrice":0,"mScreenOrientationType":2,"mIsFullScreenMode":false,"categoryId":7,"mFavoriteCount":2551426},"mIsBuiltIn":false,"mMinVerCodeNeed":1,"msg":"ok","code":0}�&.msg.appmsg.emoticonshared.packageflag��0��.msg.appmsg.action��view

@ajburley
Copy link
Author

and when the "link" (if you can call it that) is tapped, the internal wechat browser is opened and goes to URL:
https://open.weixin.qq.com/sns/share_page?appid=wx03ac32a3c1abfd1a

@ajburley
Copy link
Author

seems it got this appid value from the appid attribute of appmsg

@ajburley
Copy link
Author

20171227_203726

Here's what it looks like inside the app

@ppwwyyxx
Copy link
Owner

Thanks for showing the details. I don't know how to properly render this type of message but I think we can just add a fallback to show the whole xml content when it cannot be properly parsed.

@ajburley
Copy link
Author

It seems you already return a fallback if the prefix is anything other than "URL:" Even "FILE:" is not supported, right? (even though it can be returned from msg.py)

The current logic in msg.py is to check for a URL, if that is missing then you look for a title. If the title is present then it is assumed this is a file. However I don't think this logic is correct. I have some messages which don't fit this pattern.

If the type = 49 in "message" table then there will be a corresponding row in table "AppMessage" (with same msgId), and if you check the "type" there you can find out more about it. Here is my rough investigation so far:

4 = Video
5 = URL link
6 = File (e.g. PDF)
7 = app link (the sticker mentioned above has this type)
1 = not sure, seems to be another type of URL link
2 = used by some other apps like MeituPic
3 = not sure, some sort of audio or video
19 = chat history
2000 = money transfer
2001 = no idea

We would need to do more investigation to isolate all the AppMessage types. But I think generally, the logic on when to return "FILE" is not correct currently and also "FILE" is not even supported by render.

I think it's better to return NOTIMPLEMENTED or similar (instead of FILE) if a URL is not found, and this will cause render to return fallback. We can log the whole content value if you like. What do you think?

I guess if a URL is present then it's probably a URL link so this part of the logic may be correct unless we can prove otherwise.

@ppwwyyxx
Copy link
Owner

ppwwyyxx commented Jun 28, 2020

Now it will no longer throw an error but will use "NOTIMPLEMENTED". Would be good to implement the other subtype of TYPE=49 using the AppMessage table.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants