mirror of
https://github.com/NeteaseCloudMusicApiEnhanced/api-enhanced.git
synced 2026-10-20 14:41:23 +08:00
style: 简化createOption
This commit is contained in:
+2
-8
@@ -1,11 +1,5 @@
|
||||
// 获取广告
|
||||
// 基于逆向网易云音乐 v9.5.45 RN Hermes 源码:
|
||||
// - adService.getAd() → Network.nativeRequest → /api/ad/get
|
||||
// - 需要 X-antiCheatToken 易盾反作弊头
|
||||
// - 使用 xeapi 加密
|
||||
//
|
||||
// 返回 extra.reqId 可用于 ad_listening_rights_gain 的 reqUid
|
||||
//
|
||||
|
||||
const createOption = require('../util/option.js')
|
||||
|
||||
module.exports = async (query, request) => {
|
||||
@@ -19,7 +13,7 @@ module.exports = async (query, request) => {
|
||||
const res = await request(`/api/ad/get`, data, option)
|
||||
const raw = res.body
|
||||
|
||||
// 提取广告中的 req_id (用于领取权益)
|
||||
// 提取广告中的 req_id
|
||||
let reqId = ''
|
||||
try {
|
||||
if (raw?.ads) {
|
||||
|
||||
@@ -72,11 +72,11 @@ module.exports = async (query, request) => {
|
||||
reqParam: JSON.stringify(rightsParam),
|
||||
}
|
||||
|
||||
const option = createOption(query, 'xeapi')
|
||||
// 关键: 开启 X-antiCheatToken 头
|
||||
option.checkToken = true
|
||||
|
||||
const res = await request(`/api/ad/listening/rights/gain`, data, option)
|
||||
const res = await request(
|
||||
`/api/ad/listening/rights/gain`,
|
||||
data,
|
||||
createOption(query, 'xeapi', true),
|
||||
)
|
||||
|
||||
return {
|
||||
status: 200,
|
||||
|
||||
Reference in New Issue
Block a user