使用到的技术点: 安卓端使用xposed模拟操作+服务端数据采集使用网上开源的代理项目proxy github地址: https://github.com/monkeyWie/proxyee/
本文实现的基本原理为安卓端通过xposed操作微信打开文章的url链接, 设置代理服务器, 并通过代理拿到相应的阅读数.
1: 手机上下载https代理证书, 并安装到手机网络中
2: 本文使用的微信版本为6.6.6(已经比较老的版本了, 腾讯已经不让新用户登录该版本, 因为本人的代码基于此版本, 所以不得不使用此版本啊). 首先上xposed代码, 基础代码就不说了, 如何hook微信app等大家绕道百度一下吧.
该方法作用为微信自动打开文章url链接
public static void scan(String url, Integer paramInt1, Integer paramInt2, Integer paramInt3) throws Exception {
Object[] arrayOfObject = new Object[3];
arrayOfObject[0] = url;
arrayOfObject[1] = Integer.valueOf(paramInt2);
arrayOfObject[2] = Integer.valueOf(paramInt3);
if (url.indexOf(" ") > -1){
url = url.replaceAll(" ", "%20");
}
if (WsettingsConstant.isVersion666()) {
Object quj = MyXposedHelpers.findClass("com.tencent.mm.plugin.scanner.util.e", MainHook.getLocalClassLoader()).newInstance();
MyXposedHelpers.callMethod(quj, "a", WechatDataHook.LauncherUI, url, paramInt1, paramInt2, paramInt3, null, null);
}else if (WsettingsConstant.isVersion706()){
Object quj = MyXposedHelpers.findClass("com.tencent.mm.plugin.scanner.util.f", MainHook.getLocalClassLoader()).newInstance();
MyXposedHelpers.callMethod(quj, "a", WechatDataHook.LauncherUI, url, paramInt1, paramInt2, paramInt3, null, null);
}
}
这里做了6.6.6和7.0.6两个版本的兼容
MyXposedHelpers这些类是我自行封装了一层xposed, 本人已经做到了定制xposed(自行下载xposed源码, 重新编译), 可以防止微信检测xposed而封号
3: 下一步为服务端的逻辑, 代理程序代码就不上了, 直接上微信的阅读数链接及数据吧
阅读数链接: https://mp.weixin.qq.com/mp/getappmsgext?f=json&mock=&uin=XXX
数据格式: {"advertisement_info":[],"appmsgstat":{"show":true,"is_login":true,"liked":false,"read_num":1230,"like_num":2,"ret":0,"real_read_num":0,"version":1,"prompted":1,"like_disabled":false,"style":1,"video_pv":0,"video_uv":0,"friend_like_num":0},"comment_enabled":1,"reward_head_imgs":[],"only_fans_can_comment":true,"comment_count":0,"is_fans":1,"nick_name":"xxx","logo_url":"xxx","friend_comment_enabled":1,"base_resp":{"wxtoken":777},"more_read_list":[],"friend_subscribe_count":0,"related_tag_article":[],"original_article_count":0,"video_share_page_tag":[],"related_tag_video":[],"only_fans_days_can_comment":false,"appmsg_album_videos":[],"test_flag":0}
read_num: 阅读数
read_num: 在看
read_num: 是否允许评论
评论链接: https://mp.weixin.qq.com /mp/appmsg_comment?action=getcomment&scene=0&appmsgid=XXXX
数据格式: {"base_resp":{"ret":0,"errmsg":"ok"},"enabled":1,"is_fans":0,"nick_name":"xxx","logo_url":"xxx","my_comment":[],"elected_comment":[],"friend_comment":[],"elected_comment_total_cnt":0,"only_fans_can_comment":false,"only_fans_days_can_comment":false}
本文的方法可以大批量采集, 量大直接上设备上号就能解决问题.
中间踩过很多坑, 比如如何规避个号被封, 如何降级安装微信等等,任务间的协同处理这些细节本文都略过了, 感兴趣大家可以留言交流交流.
后续文章讲继续出主动查询公众号历史文章, 以及hook公众号文章推送数据