Skip to content

Commit

Permalink
feat:增加电台部分接口
Browse files Browse the repository at this point in the history
  • Loading branch information
overwriter committed Nov 4, 2023
1 parent 81473e3 commit 5507a8b
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 5 deletions.
88 changes: 83 additions & 5 deletions QCloudMusicApi/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,7 @@ const QVariantMap NeteaseCloudMusicApi::dj_banner(QVariantMap query) {
"https://music.163.com/weapi/djradio/banner/get",
data,
QVariantMap {
{ "crypto", "eapi" },
{ "crypto", "weapi" },
{ "cookie", query["cookie"] },
{ "proxy", query["proxy"] },
{ "realIP", query["realIP"] },
Expand All @@ -933,7 +933,7 @@ const QVariantMap NeteaseCloudMusicApi::dj_category_excludehot(QVariantMap query
"https://music.163.com/weapi/djradio/category/excludehot",
data,
QVariantMap {
{ "crypto", "eapi" },
{ "crypto", "weapi" },
{ "cookie", query["cookie"] },
{ "proxy", query["proxy"] },
{ "realIP", query["realIP"] },
Expand All @@ -950,7 +950,7 @@ const QVariantMap NeteaseCloudMusicApi::dj_category_recommend(QVariantMap query)
"https://music.163.com/weapi/djradio/home/category/recommend",
data,
QVariantMap {
{ "crypto", "eapi" },
{ "crypto", "weapi" },
{ "cookie", query["cookie"] },
{ "proxy", query["proxy"] },
{ "realIP", query["realIP"] },
Expand All @@ -967,7 +967,7 @@ const QVariantMap NeteaseCloudMusicApi::dj_catelist(QVariantMap query) {
"https://music.163.com/weapi/djradio/category/get",
data,
QVariantMap {
{ "crypto", "eapi" },
{ "crypto", "weapi" },
{ "cookie", query["cookie"] },
{ "proxy", query["proxy"] },
{ "realIP", query["realIP"] },
Expand All @@ -986,7 +986,85 @@ const QVariantMap NeteaseCloudMusicApi::dj_detail(QVariantMap query) {
"https://music.163.com/api/djradio/v2/get",
data,
QVariantMap {
{ "crypto", "eapi" },
{ "crypto", "weapi" },
{ "cookie", query["cookie"] },
{ "proxy", query["proxy"] },
{ "realIP", query["realIP"] },
{ "url", "/api/fanscenter/basicinfo/age/get" }
}
);
}

// 热门电台
const QVariantMap NeteaseCloudMusicApi::dj_hot(QVariantMap query) {
const QVariantMap data {
{ "limit", query.value("limit", 30) },
{ "offset", query.value("offset", 0) }
};
return createRequest(
QNetworkAccessManager::PostOperation,
"https://music.163.com/weapi/djradio/hot/v1",
data,
QVariantMap {
{ "crypto", "weapi" },
{ "cookie", query["cookie"] },
{ "proxy", query["proxy"] },
{ "realIP", query["realIP"] },
{ "url", "/api/fanscenter/basicinfo/age/get" }
}
);
}

// 付费电台
const QVariantMap NeteaseCloudMusicApi::dj_paygift(QVariantMap query) {
const QVariantMap data {
{ "limit", query.value("limit", 30) },
{ "offset", query.value("offset", 0) }
};
return createRequest(
QNetworkAccessManager::PostOperation,
"https://music.163.com/weapi/djradio/home/paygift/list?_nmclfl=1",
data,
QVariantMap {
{ "crypto", "weapi" },
{ "cookie", query["cookie"] },
{ "proxy", query["proxy"] },
{ "realIP", query["realIP"] },
{ "url", "/api/fanscenter/basicinfo/age/get" }
}
);
}

// 电台个性推荐
const QVariantMap NeteaseCloudMusicApi::dj_personalize_recommend(QVariantMap query) {
const QVariantMap data {
{ "limit", query.value("limit", 6) }
};
return createRequest(
QNetworkAccessManager::PostOperation,
"https://music.163.com/api/djradio/personalize/rcmd",
data,
QVariantMap {
{ "crypto", "weapi" },
{ "cookie", query["cookie"] },
{ "proxy", query["proxy"] },
{ "realIP", query["realIP"] },
{ "url", "/api/fanscenter/basicinfo/age/get" }
}
);
}

// 电台节目详情
const QVariantMap NeteaseCloudMusicApi::dj_program_detail(QVariantMap query) {
const QVariantMap data {
{ "id", query["id"] }
};
return createRequest(
QNetworkAccessManager::PostOperation,
"https://music.163.com/api/dj/program/detail",
data,
QVariantMap {
{ "crypto", "weapi" },
{ "cookie", query["cookie"] },
{ "proxy", query["proxy"] },
{ "realIP", query["realIP"] },
Expand Down
12 changes: 12 additions & 0 deletions QCloudMusicApi/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,18 @@ class QCLOUDMUSICAPI_EXPORT NeteaseCloudMusicApi: public QObject {
// 电台详情
Q_INVOKABLE const QVariantMap dj_detail(QVariantMap query);

// 热门电台
Q_INVOKABLE const QVariantMap dj_hot(QVariantMap query);

// 付费电台
Q_INVOKABLE const QVariantMap dj_paygift(QVariantMap query);

// 电台个性推荐
Q_INVOKABLE const QVariantMap dj_personalize_recommend(QVariantMap query);

// 电台节目详情
Q_INVOKABLE const QVariantMap dj_program_detail(QVariantMap query);

// 粉丝年龄比例
Q_INVOKABLE const QVariantMap fanscenter_basicinfo_age_get(QVariantMap query);

Expand Down
3 changes: 3 additions & 0 deletions Test/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -179,5 +179,8 @@
},
"dj_detail": {
"rid": "336355127"
},
"dj_program_detail": {
"id": "1367665101"
}
}

0 comments on commit 5507a8b

Please sign in to comment.