This repository has been archived by the owner on Jul 9, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 344
获取好友、群、讨论组列表 Api
ScienJus edited this page Dec 23, 2015
·
1 revision
请求方式:Post
请求 URL:http://s.web2.qq.com/api/get_group_name_list_mask2
Referer:http://d1.web2.qq.com/proxy.html?v=20151105001&callback=1&id=2
请求参数只有一个r
,值是一个 Json,内容为:
{
"vfwebqq": "${vfwebqq}",
"hash": "${hash}"
}
vfwebqq
依旧是登录返回的参数,hash
是uin
和ptwebqq
进行加密后的数据,这里提供 Java 版本的加密算法:
private static String hash(long x, String K) {
int[] N = new int[4];
for (int T = 0; T < K.length(); T++) {
N[T % 4] ^= K.charAt(T);
}
String[] U = {"EC", "OK"};
long[] V = new long[4];
V[0] = x >> 24 & 255 ^ U[0].charAt(0);
V[1] = x >> 16 & 255 ^ U[0].charAt(1);
V[2] = x >> 8 & 255 ^ U[1].charAt(0);
V[3] = x & 255 ^ U[1].charAt(1);
long[] U1 = new long[8];
for (int T = 0; T < 8; T++) {
U1[T] = T % 2 == 0 ? N[T >> 1] : V[T >> 1];
}
String[] N1 = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"};
String V1 = "";
for (long aU1 : U1) {
V1 += N1[(int) ((aU1 >> 4) & 15)];
V1 += N1[(int) (aU1 & 15)];
}
return V1;
}
请求成功后会返回一个 Json 对象,格式为:
{
"retcode": 0,
"result": {
"gmasklist": [],
"gnamelist": [
{
"flag": 167864331,
"name": "群名",
"gid": 14611812014,
"code": 3157131718
}
],
"gmarklist": [
{
"uin": 18796074161,
"markname": "备注"
}
]
}
}
当retcode
的值为0
时说明此次请求是成功的。result
中包含了3个 JsonArray:
-
gnamelist
包含群信息,其中name
为群名称,gid
为群编号,code
和flag
暂时不知道有什么用。 -
gmarklist
包含群的备注信息,uin
为群编号,markname
为备注名。 -
gmasklist
暂时不知道有什么用。
请求方式:Post
请求 http://s.web2.qq.com/api/get_user_friends2
Referer:http://s.web2.qq.com/proxy.html?v=20130916001&callback=1&id=1
请求参数和获取群列表一样。请求成功后会返回一个 Json 对象,格式为:
{
"retcode": 0,
"result": {
"friends": [
{
"flag": 4,
"uin": 41837138855,
"categories": 1
}
],
"marknames": [
{
"uin": 37761915054,
"markname": "备注",
"type": 0
}
],
"categories": [
{
"index": 0,
"sort": 2,
"name": "同学"
}
],
"vipinfo": [
{
"vip_level": 0,
"u": 20191343597,
"is_vip": 0
}
],
"info": [
{
"face": 603,
"flag": 4751942,
"nick": "昵称",
"uin": 41837138855
}
]
}
}
当retcode
的值为0
时说明此次请求是成功的。result
下有多个 JsonArray 对象:
-
friend
的uin
为用户编号,categories
为所属的分组编号。 -
marknames
的uin
为用户编号,markname
为备注。 -
categories
的index
为组编号,name
为组名,sort
为排列顺序。 -
vipinfo
的u
为用户编号,is_vip
为是否为会员,vip_level
为会员等级。 -
info
的uin
为用户编号,nick
为用户的昵称。
请求方式:Get
Referer:http://d1.web2.qq.com/proxy.html?v=20151105001&callback=1&id=2
Url 中有两个动态参数,都是登录后返回的数据,就不再重复了。
请求成功后会返回一个 Json 对象,格式为:
{
"retcode": 0,
"result": {
"dnamelist": [
{
"did": 167864331,
"name": "讨论组名",
}
]
}
}
当retcode
的值为0
时说明此次请求是成功的。dnamelist
为讨论组列表,其中did
为讨论组编号,name
为讨论组名称。