From e1552866ada8a31c7ae4b84e276d009fc51e23e1 Mon Sep 17 00:00:00 2001 From: overwriter Date: Sat, 4 Nov 2023 20:58:26 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=A2=9E=E5=8A=A0=E7=94=B5=E5=8F=B0?= =?UTF-8?q?=E9=83=A8=E5=88=86=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- QCloudMusicApi/module.cpp | 106 +++++++++++++++++++++++++++++++------- QCloudMusicApi/module.h | 12 +++++ Test/config.json | 6 +++ Test/mainwindow.ui | 4 +- 4 files changed, 108 insertions(+), 20 deletions(-) diff --git a/QCloudMusicApi/module.cpp b/QCloudMusicApi/module.cpp index 1e098e8..c1b3e2a 100644 --- a/QCloudMusicApi/module.cpp +++ b/QCloudMusicApi/module.cpp @@ -919,8 +919,7 @@ const QVariantMap NeteaseCloudMusicApi::dj_banner(QVariantMap query) { { "crypto", "weapi" }, { "cookie", query["cookie"] }, { "proxy", query["proxy"] }, - { "realIP", query["realIP"] }, - { "url", "/api/fanscenter/basicinfo/age/get" } + { "realIP", query["realIP"] } } ); } @@ -936,8 +935,7 @@ const QVariantMap NeteaseCloudMusicApi::dj_category_excludehot(QVariantMap query { "crypto", "weapi" }, { "cookie", query["cookie"] }, { "proxy", query["proxy"] }, - { "realIP", query["realIP"] }, - { "url", "/api/fanscenter/basicinfo/age/get" } + { "realIP", query["realIP"] } } ); } @@ -953,8 +951,7 @@ const QVariantMap NeteaseCloudMusicApi::dj_category_recommend(QVariantMap query) { "crypto", "weapi" }, { "cookie", query["cookie"] }, { "proxy", query["proxy"] }, - { "realIP", query["realIP"] }, - { "url", "/api/fanscenter/basicinfo/age/get" } + { "realIP", query["realIP"] } } ); } @@ -970,8 +967,7 @@ const QVariantMap NeteaseCloudMusicApi::dj_catelist(QVariantMap query) { { "crypto", "weapi" }, { "cookie", query["cookie"] }, { "proxy", query["proxy"] }, - { "realIP", query["realIP"] }, - { "url", "/api/fanscenter/basicinfo/age/get" } + { "realIP", query["realIP"] } } ); } @@ -989,8 +985,7 @@ const QVariantMap NeteaseCloudMusicApi::dj_detail(QVariantMap query) { { "crypto", "weapi" }, { "cookie", query["cookie"] }, { "proxy", query["proxy"] }, - { "realIP", query["realIP"] }, - { "url", "/api/fanscenter/basicinfo/age/get" } + { "realIP", query["realIP"] } } ); } @@ -1009,8 +1004,7 @@ const QVariantMap NeteaseCloudMusicApi::dj_hot(QVariantMap query) { { "crypto", "weapi" }, { "cookie", query["cookie"] }, { "proxy", query["proxy"] }, - { "realIP", query["realIP"] }, - { "url", "/api/fanscenter/basicinfo/age/get" } + { "realIP", query["realIP"] } } ); } @@ -1029,8 +1023,7 @@ const QVariantMap NeteaseCloudMusicApi::dj_paygift(QVariantMap query) { { "crypto", "weapi" }, { "cookie", query["cookie"] }, { "proxy", query["proxy"] }, - { "realIP", query["realIP"] }, - { "url", "/api/fanscenter/basicinfo/age/get" } + { "realIP", query["realIP"] } } ); } @@ -1048,8 +1041,7 @@ const QVariantMap NeteaseCloudMusicApi::dj_personalize_recommend(QVariantMap que { "crypto", "weapi" }, { "cookie", query["cookie"] }, { "proxy", query["proxy"] }, - { "realIP", query["realIP"] }, - { "url", "/api/fanscenter/basicinfo/age/get" } + { "realIP", query["realIP"] } } ); } @@ -1067,8 +1059,86 @@ const QVariantMap NeteaseCloudMusicApi::dj_program_detail(QVariantMap query) { { "crypto", "weapi" }, { "cookie", query["cookie"] }, { "proxy", query["proxy"] }, - { "realIP", query["realIP"] }, - { "url", "/api/fanscenter/basicinfo/age/get" } + { "realIP", query["realIP"] } + } + ); +} + +// 电台24小时节目榜 +const QVariantMap NeteaseCloudMusicApi::dj_program_toplist_hours(QVariantMap query) { + const QVariantMap data { + { "limit", query.value("limit", 100) } + // 不支持 offset + }; + return createRequest( + QNetworkAccessManager::PostOperation, + "https://music.163.com/api/djprogram/toplist/hours", + data, + QVariantMap { + { "crypto", "weapi" }, + { "cookie", query["cookie"] }, + { "proxy", query["proxy"] }, + { "realIP", query["realIP"] } + } + ); +} + +// 电台节目榜 +const QVariantMap NeteaseCloudMusicApi::dj_program_toplist(QVariantMap query) { + const QVariantMap data { + { "limit", query.value("limit", 100) }, + { "offset", query.value("offset", 0) } + }; + return createRequest( + QNetworkAccessManager::PostOperation, + "https://music.163.com/api/program/toplist/v1", + data, + QVariantMap { + { "crypto", "weapi" }, + { "cookie", query["cookie"] }, + { "proxy", query["proxy"] }, + { "realIP", query["realIP"] } + } + ); +} + +// 电台节目列表 +const QVariantMap NeteaseCloudMusicApi::dj_program(QVariantMap query) { + const QVariantMap data { + { "radioId", query["rid"] }, + { "limit", query.value("limit", 30) }, + { "offset", query.value("offset", 0) }, + { "asc", query["asc"] } + }; + return createRequest( + QNetworkAccessManager::PostOperation, + "https://music.163.com/weapi/dj/program/byradio", + data, + QVariantMap { + { "crypto", "weapi" }, + { "cookie", query["cookie"] }, + { "proxy", query["proxy"] }, + { "realIP", query["realIP"] } + } + ); +} + +// 类别热门电台 +const QVariantMap NeteaseCloudMusicApi::dj_radio_hot(QVariantMap query) { + const QVariantMap data { + { "cateId", query["cateId"] }, + { "limit", query.value("limit", 30) }, + { "offset", query.value("offset", 0) } + }; + return createRequest( + QNetworkAccessManager::PostOperation, + "https://music.163.com/api/djradio/hot", + data, + QVariantMap { + { "crypto", "weapi" }, + { "cookie", query["cookie"] }, + { "proxy", query["proxy"] }, + { "realIP", query["realIP"] } } ); } diff --git a/QCloudMusicApi/module.h b/QCloudMusicApi/module.h index 22b0089..43d564c 100644 --- a/QCloudMusicApi/module.h +++ b/QCloudMusicApi/module.h @@ -196,6 +196,18 @@ class QCLOUDMUSICAPI_EXPORT NeteaseCloudMusicApi: public QObject { // 电台节目详情 Q_INVOKABLE const QVariantMap dj_program_detail(QVariantMap query); + // 电台24小时节目榜 + Q_INVOKABLE const QVariantMap dj_program_toplist_hours(QVariantMap query); + + // 电台节目榜 + Q_INVOKABLE const QVariantMap dj_program_toplist(QVariantMap query); + + // 电台节目列表 + Q_INVOKABLE const QVariantMap dj_program(QVariantMap query); + + // 类别热门电台 + Q_INVOKABLE const QVariantMap dj_radio_hot(QVariantMap query); + // 粉丝年龄比例 Q_INVOKABLE const QVariantMap fanscenter_basicinfo_age_get(QVariantMap query); diff --git a/Test/config.json b/Test/config.json index 6ee8e5f..e55be2b 100644 --- a/Test/config.json +++ b/Test/config.json @@ -182,5 +182,11 @@ }, "dj_program_detail": { "id": "1367665101" + }, + "dj_program": { + "rid": "336355127" + }, + "dj_radio_hot": { + "cateId": "2001" } } \ No newline at end of file diff --git a/Test/mainwindow.ui b/Test/mainwindow.ui index 640ba86..fd340f2 100644 --- a/Test/mainwindow.ui +++ b/Test/mainwindow.ui @@ -11,7 +11,7 @@ - MainWindow + QCloudMusicApi Test @@ -91,7 +91,7 @@ li.checked::marker { content: "\2612"; } 0 0 800 - 25 + 21