Skip to content

Commit 89c73d9

Browse files
committed
feat:增加部分接口
1 parent 8ad3c0c commit 89c73d9

File tree

3 files changed

+277
-0
lines changed

3 files changed

+277
-0
lines changed

QCloudMusicApi/module.cpp

Lines changed: 217 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2533,6 +2533,56 @@ QVariantMap Api::user_binding(QVariantMap query) {
25332533
);
25342534
}
25352535

2536+
// 云盘歌曲删除
2537+
QVariantMap Api::user_cloud_del(QVariantMap query) {
2538+
const QVariantMap data {
2539+
{ "songIds", QVariantList{ query["id"] } }
2540+
};
2541+
return request(
2542+
POST,
2543+
"https://music.163.com/weapi/cloud/del",
2544+
data,
2545+
{
2546+
{ "crypto", "weapi" },
2547+
_PARAM
2548+
}
2549+
);
2550+
}
2551+
2552+
// 云盘数据详情
2553+
QVariantMap Api::user_cloud_detail(QVariantMap query) {
2554+
const auto id = query["id"].toString().replace("\s", "").split(",");
2555+
const QVariantMap data {
2556+
{ "songIds", id }
2557+
};
2558+
return request(
2559+
POST,
2560+
"https://music.163.com/weapi/v1/cloud/get/byids",
2561+
data,
2562+
{
2563+
{ "crypto", "weapi" },
2564+
_PARAM
2565+
}
2566+
);
2567+
}
2568+
2569+
// 云盘数据
2570+
QVariantMap Api::user_cloud(QVariantMap query) {
2571+
const QVariantMap data {
2572+
{ "limit", query.value("limit", 30) },
2573+
{ "offset", query.value("offset", 0) }
2574+
};
2575+
return request(
2576+
POST,
2577+
"https://music.163.com/api/v1/cloud/get",
2578+
data,
2579+
{
2580+
{ "crypto", "weapi" },
2581+
_PARAM
2582+
}
2583+
);
2584+
}
2585+
25362586
// 获取用户历史评论
25372587
QVariantMap Api::user_comment_history(QVariantMap query) {
25382588
QVariantMap cookie = query["cookie"].toMap();
@@ -2570,6 +2620,99 @@ QVariantMap Api::user_detail(QVariantMap query) {
25702620
);
25712621
}
25722622

2623+
// 用户电台节目
2624+
QVariantMap Api::user_dj(QVariantMap query) {
2625+
const QVariantMap data {
2626+
{ "limit", query.value("limit", 30) },
2627+
{ "offset", query.value("offset", 0) }
2628+
};
2629+
return request(
2630+
POST,
2631+
"https://music.163.com/weapi/dj/program/" + query["uid"].toString(),
2632+
data,
2633+
{
2634+
{ "crypto", "weapi" },
2635+
_PARAM
2636+
}
2637+
);
2638+
}
2639+
2640+
// 用户动态
2641+
QVariantMap Api::user_event(QVariantMap query) {
2642+
QVariantMap cookie = query["cookie"].toMap();
2643+
cookie["os"] = "ios";
2644+
cookie["appver"] = "8.10.90";
2645+
query["cookie"] = cookie;
2646+
const QVariantMap data {
2647+
{ "getcounts", true },
2648+
{ "time", query.value("lasttime", -1) },
2649+
{ "limit", query.value("limit", 30) },
2650+
{ "total", false }
2651+
};
2652+
return request(
2653+
POST,
2654+
"https://music.163.com/api/event/get/" + query["uid"].toString(),
2655+
data,
2656+
{
2657+
{ "crypto", "api" },
2658+
_PARAM
2659+
}
2660+
);
2661+
}
2662+
2663+
// 关注TA的人(粉丝)
2664+
QVariantMap Api::user_followeds(QVariantMap query) {
2665+
const QVariantMap data {
2666+
{ "userId", query["uid"] },
2667+
{ "time", "0" },
2668+
{ "limit", query.value("limit", 30) },
2669+
{ "offset", query.value("offset", 0) },
2670+
{ "getcounts", "true" }
2671+
};
2672+
return request(
2673+
POST,
2674+
"https://music.163.com/eapi/user/getfolloweds/" + query["uid"].toString(),
2675+
data,
2676+
{
2677+
{ "crypto", "eapi" },
2678+
_PARAM,
2679+
{ "url", "/api/user/getfolloweds" }
2680+
}
2681+
);
2682+
}
2683+
2684+
// TA关注的人(关注)
2685+
QVariantMap Api::user_follows(QVariantMap query) {
2686+
const QVariantMap data {
2687+
{ "offset", query.value("offset", 0) },
2688+
{ "limit", query.value("limit", 30) },
2689+
{ "order", true }
2690+
};
2691+
return request(
2692+
POST,
2693+
"https://music.163.com/weapi/user/getfollows/" + query["uid"].toString(),
2694+
data,
2695+
{
2696+
{ "crypto", "weapi" },
2697+
_PARAM
2698+
}
2699+
);
2700+
}
2701+
2702+
// 获取用户等级信息
2703+
QVariantMap Api::user_level(QVariantMap query) {
2704+
const QVariantMap data { };
2705+
return request(
2706+
POST,
2707+
"https://music.163.com/weapi/user/level",
2708+
data,
2709+
{
2710+
{ "crypto", "weapi" },
2711+
_PARAM
2712+
}
2713+
);
2714+
}
2715+
25732716
// 用户歌单
25742717
QVariantMap Api::user_playlist(QVariantMap query) {
25752718
const QVariantMap data {
@@ -2589,6 +2732,80 @@ QVariantMap Api::user_playlist(QVariantMap query) {
25892732
);
25902733
}
25912734

2735+
// 听歌排行
2736+
QVariantMap Api::user_record(QVariantMap query) {
2737+
const QVariantMap data {
2738+
{ "uid", query["uid"] },
2739+
{ "type", query.value("type", 0) } // 1: 最近一周, 0: 所有时间
2740+
};
2741+
return request(
2742+
POST,
2743+
"https://music.163.com/weapi/v1/play/record",
2744+
data,
2745+
{
2746+
{ "crypto", "weapi" },
2747+
_PARAM
2748+
}
2749+
);
2750+
}
2751+
2752+
// 用户绑定手机
2753+
QVariantMap Api::user_replacephone(QVariantMap query) {
2754+
const QVariantMap data {
2755+
{ "phone", query["phone"] },
2756+
{ "captcha", query["captcha"] },
2757+
{ "oldcaptcha", query["oldcaptcha"] },
2758+
{ "countrycode", query.value("countrycode", 86) }
2759+
};
2760+
return request(
2761+
POST,
2762+
"https://music.163.com/api/user/replaceCellphone",
2763+
data,
2764+
{
2765+
{ "crypto", "weapi" },
2766+
_PARAM
2767+
}
2768+
);
2769+
}
2770+
2771+
// 收藏计数
2772+
QVariantMap Api::user_subcount(QVariantMap query) {
2773+
return request(
2774+
POST,
2775+
"https://music.163.com/weapi/subcount",
2776+
{},
2777+
{
2778+
{ "crypto", "weapi" },
2779+
_PARAM
2780+
}
2781+
);
2782+
}
2783+
2784+
// 编辑用户信息
2785+
QVariantMap Api::user_update(QVariantMap query) {
2786+
QVariantMap cookie = query["cookie"].toMap();
2787+
cookie["os"] = "ios";
2788+
cookie["appver"] = "8.10.90";
2789+
query["cookie"] = cookie;
2790+
const QVariantMap data {
2791+
{ "birthday", query["birthday"] },
2792+
{ "city", query["city"] },
2793+
{ "gender", query["gender"] },
2794+
{ "nickname", query["nickname"] },
2795+
{ "province", query["province"] },
2796+
{ "signature", query["signature"] },
2797+
};
2798+
return request(
2799+
POST,
2800+
"https://music.163.com/api/user/profile/update",
2801+
data,
2802+
{
2803+
{ "crypto", "weapi" },
2804+
_PARAM
2805+
}
2806+
);
2807+
}
2808+
25922809
// 云贝 todo 任务
25932810
QVariantMap Api::yunbei_tasks_todo(QVariantMap query) {
25942811
const QVariantMap data {};

QCloudMusicApi/module.h

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@
33

44
#include <QVariantMap>
55

6+
#if defined(_MSC_VER) || defined(WIN64) || defined(_WIN64) || defined(__WIN64__) || defined(WIN32) \
7+
|| defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
8+
#define Q_DECL_EXPORT __declspec(dllexport)
9+
#define Q_DECL_IMPORT __declspec(dllimport)
10+
#else
11+
#define Q_DECL_EXPORT __attribute__((visibility("default")))
12+
#define Q_DECL_IMPORT __attribute__((visibility("default")))
13+
#endif
14+
615
#if defined(QCLOUDMUSICAPI_LIBRARY)
716
# define QCLOUDMUSICAPI_EXPORT Q_DECL_EXPORT
817
#else
@@ -446,15 +455,51 @@ class QCLOUDMUSICAPI_EXPORT NeteaseCloudMusicApi: public QObject {
446455
// 获取用户绑定信息
447456
Q_INVOKABLE QVariantMap user_binding(QVariantMap);
448457

458+
// 云盘歌曲删除
459+
Q_INVOKABLE QVariantMap user_cloud_del(QVariantMap);
460+
461+
// 云盘数据详情
462+
Q_INVOKABLE QVariantMap user_cloud_detail(QVariantMap);
463+
464+
// 云盘数据
465+
Q_INVOKABLE QVariantMap user_cloud(QVariantMap);
466+
449467
// 获取用户历史评论
450468
Q_INVOKABLE QVariantMap user_comment_history(QVariantMap);
451469

452470
// 用户详情
453471
Q_INVOKABLE QVariantMap user_detail(QVariantMap);
454472

473+
// 用户电台节目
474+
Q_INVOKABLE QVariantMap user_dj(QVariantMap);
475+
476+
// 用户动态
477+
Q_INVOKABLE QVariantMap user_event(QVariantMap);
478+
479+
// 关注TA的人(粉丝)
480+
Q_INVOKABLE QVariantMap user_followeds(QVariantMap);
481+
482+
// TA关注的人(关注)
483+
Q_INVOKABLE QVariantMap user_follows(QVariantMap);
484+
485+
// 获取用户等级信息
486+
Q_INVOKABLE QVariantMap user_level(QVariantMap);
487+
455488
// 用户歌单
456489
Q_INVOKABLE QVariantMap user_playlist(QVariantMap);
457490

491+
// 听歌排行
492+
Q_INVOKABLE QVariantMap user_record(QVariantMap);
493+
494+
// 用户绑定手机
495+
Q_INVOKABLE QVariantMap user_replacephone(QVariantMap);
496+
497+
// 收藏计数
498+
Q_INVOKABLE QVariantMap user_subcount(QVariantMap);
499+
500+
// 编辑用户信息
501+
Q_INVOKABLE QVariantMap user_update(QVariantMap);
502+
458503
// 云贝 todo 任务
459504
Q_INVOKABLE QVariantMap yunbei_tasks_todo(QVariantMap);
460505

Test/config.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,5 +261,20 @@
261261
},
262262
"user_audio": {
263263
"uid": "79248480"
264+
},
265+
"user_dj": {
266+
"uid": "79248480"
267+
},
268+
"user_event": {
269+
"uid": "79248480"
270+
},
271+
"user_followeds": {
272+
"uid": "79248480"
273+
},
274+
"user_follows": {
275+
"uid": "79248480"
276+
},
277+
"user_record": {
278+
"uid": "79248480"
264279
}
265280
}

0 commit comments

Comments
 (0)