buzzk 1.9.13 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/live.js +11 -2
- package/package.json +1 -1
package/lib/live.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const { reqChzzk } = require("./tool.js");
|
|
1
|
+
const { reqChzzk, reqGame } = require("./tool.js");
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @typedef {Object} chzzkLiveDetail
|
|
@@ -106,7 +106,16 @@ async function getStatus (channelID) {
|
|
|
106
106
|
});
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
+
async function getAccess (chatID) {
|
|
110
|
+
return new Promise(async (resolve, reject) => {
|
|
111
|
+
let accRes = await reqGame("nng_main/v1/chats/access-token?channelId=" + chatID + "&chatType=STREAMING");
|
|
112
|
+
if (accRes.code != 200) return resolve(null);
|
|
113
|
+
return resolve(accRes.content.accessToken);
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
|
|
109
117
|
module.exports = {
|
|
110
118
|
getDetail: getDetail,
|
|
111
|
-
getStatus: getStatus
|
|
119
|
+
getStatus: getStatus,
|
|
120
|
+
getAccess: getAccess
|
|
112
121
|
}
|