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 5507a8b commit e155286
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 20 deletions.
106 changes: 88 additions & 18 deletions QCloudMusicApi/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
}
);
}
Expand All @@ -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"] }
}
);
}
Expand All @@ -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"] }
}
);
}
Expand All @@ -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"] }
}
);
}
Expand All @@ -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"] }
}
);
}
Expand All @@ -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"] }
}
);
}
Expand All @@ -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"] }
}
);
}
Expand All @@ -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"] }
}
);
}
Expand All @@ -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"] }
}
);
}
Expand Down
12 changes: 12 additions & 0 deletions QCloudMusicApi/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
6 changes: 6 additions & 0 deletions Test/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -182,5 +182,11 @@
},
"dj_program_detail": {
"id": "1367665101"
},
"dj_program": {
"rid": "336355127"
},
"dj_radio_hot": {
"cateId": "2001"
}
}
4 changes: 2 additions & 2 deletions Test/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
<string>QCloudMusicApi Test</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout">
Expand Down Expand Up @@ -91,7 +91,7 @@ li.checked::marker { content: &quot;\2612&quot;; }
<x>0</x>
<y>0</y>
<width>800</width>
<height>25</height>
<height>21</height>
</rect>
</property>
</widget>
Expand Down

0 comments on commit e155286

Please sign in to comment.