本文共 4165 字,大约阅读时间需要 13 分钟。
/**
* QQ群登录流程 * 1. 登录表单页是一个iframe,直接取得iframe地址即可 * * 2. 登录页需要两个JS文件 * * * 及以下JS代码: * <pre> <script language="javascript"> //映射模板文件中的文字,第一列为字符串ID, 第二列为模板文件中的标签ID var g_labelMap = new Array([STR_UINTIP, "u"], [STR_UIN, "label_uin"], [STR_PWD, "label_pwd"], [STR_VCODE, "label_vcode"], [STR_VCODE_TIP, "label_vcode_tip"], [STR_CHANGE_VCODE, "changeimg_link"], [STR_REMEMBER_PWD, "label_remember_pwd"], [STR_FORGET_PWD, "label_forget_pwd"], [STR_LOGIN, "login_button"], [STR_SWITCH_QLOGIN, "label_switch_qlogin"], [STR_LOGIN_TITLE, "label_login_title"], [STR_QLOGIN_INTRO, "label_qlogin_intro"], [STR_QLOGINING, "label_qlogining"], [STR_QLOGIN_HELP, "label_qlogin_help"], [STR_SWITCH_NORMAL, "label_switch_normal"], [STR_QLOGIN, "loginbtn"], [STR_1_DAY, "label_1_day"], [STR_1_WEEK, "label_1_week"], [STR_1_MONTH, "label_1_month"], [STR_HALF_YEAR, "label_half_year"], [STR_1_YEAR, "label_1_year"], [STR_QLOGIN_SELECT, "btn_qlogin_select"], [STR_QLOGIN_VER, "label_qlogin_ver"], [STR_QLOGIN_SELECT_TIP, "qlogin_select_tip"], [STR_NEW_REG, "label_newreg"] ); document.domain="qq.com"; </script> * </pre> * 3. 在登录时,js方法的调用链如下: * 1) ptui_onLogin(loginform) (由于没有parent,直接进catch段) * 2) ptui_checkValidate(A) * 3) preprocess(B) (这个方法用验证码和密码作了一个md5作为发送的密码) * <pre> function preprocess(A) { var B=""; B+=A.verifycode.value; B=B.toUpperCase(); A.p.value=md5(md5_3(A.p.value)+B); return true } * </pre> * 4. 登录后,有一个跳转(这个url为群首页的url) * top.location.href='http://qun.qq.com/air/'; * 5. 取群首页后,发现里面没有群数据 * 用FireBug在Firefox下查看HTML,发现 * <div id="container" class="module clear index"> * ...... 群信息 * </div> * 但是查看源代码时:为空 * <div id="container" class="module hide clear"></div> * 原因是:在加载这个界面后,利用jQuery发送了ajax请求来加载数据,页面中有这样的代码: * <pre> <script type="text/javascript"> document.domain = "qq.com"; jL.script({mark: "jquery", uri: "/god/m/js/jquery.zh-cn.js?_=90168", depend: true}); jL.script({mark: "jquery-plugins", uri: "/god/m/js/jquery/plugins.zh-cn.js?_=90168", depend: true}); jL.script({mark: "frame", uri: "/god/m/js/frame.zh-cn.js?_=90168", depend: true, onload: function(p) { if ( $.browser.msie && "6.0" == $.browser.version ) { document.execCommand("BackgroundImageCache", false, true); } G.run(p); }, params: { request: location.href, domain: "qun.qq.com", server: "172.27.9.160", client: "218.247.140.212", elapsed: "0.0071", memory: "0.36MB", profile: "T_LOAD: 0.0010S|T_ROUTE: 0.0007S|T_DISPATCH: 0.0044S|", module: "default", controller: "index", action: "frame", env: "live", way: "frame", language : "zh-cn", user: { id: "174928349", nick: "%2Fyl%E6%98%9F%E6%98%9F%2Fsun", gkey: "BHE1Oj3yHHH74abUNDATOW3CSdVhraVTeJbVe8Wq3A7m2LhxvUcoBURDkDnXJrCtI39xqfRPtXs=" }, group: { id: "0", auth: "0", permission: "2", type: "1" }, gray: { activity: { list: "77831330,90327334,66260371,65148366,85292093,75405323,75405369,86330865,83449971,40761197,81358376,101812", limit: "0,0,0,0,0,0", type: "0,0,0", pause: "0,0,0" }, talk: { list: "77831330,66260371,90327334,2118523,800000,66260371,90327334,54930271,85292093,86502476,90357511,60287818,65148366,86330865,90327334,21733222,26179977,26181133,75405323,75405369,86330865,86329942,85292093,86502476,90357511,60287818,65148366,86330865,90327334", limit: "0,0,0,0,0,0", type: "1,1,1" }, share: { list: "77831330,90327334,66260371,65148366,85292093,75405323,75405369,86330865,21733222,14038681", limit: "0,0,0,0,0,0", type: "0,0,0" }, carlife: { list: "71613924,90327334,66260371,65148366,85292093,75405323,75405369,86330865,83449971,40761197,81358376,101812,73420458,86329942,3358319,84577550,52894074,76529446,88097716,82098329,1902014,90330504,85489485,27342898,25427741,87369050,85489485", limit: "0,0,0,0,0,0", type: "1,1,1", classtype: "6,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368" } } }}); </script> * </pre> * 利用HttpWatch跟踪后,得到群的JSON数据地址为: * * 可以取到群的基本信息,如果再取好友,需要到通讯录页 * 6. 取好友 * url形式为:; * 其中2447222为群号,addr/index/type/1/p/1中最后一个数字1为页号 * 因此要取所有好友必须访问所有的分页url(递归过程) * * * * 等等 * 步骤: * (1)取第一页取出好友 * (2)取第一页的所有分页链接(注意去重) * (3)访问其他页链接并取出好友(如果其他页链接已访问过了,不再访问) */转载地址:http://sofmd.baihongyu.com/