nicommentDanime

dアニメでニコニコのコメントを流す

< 脚本nicommentDanime的反馈

提问/评论

§
发表于:2024-04-13

コメントはこんな感じのapiで取れます
paramsとthreadKeyはニコニコ動画の視聴ページのapiDataにあるデータです

const threadKey = window.opener.NicoCache_nl.watch.apiData.comment.nvComment.threadKey
const params = window.opener.NicoCache_nl.watch.apiData.comment.nvComment.params
const url = `https://nv-comment.nicovideo.jp/v1/threads`

/**
*
* @returns {object}
*/
function getnv(url,params,threadKey) {
return fetch(url,{
method : "POST",
timeout: 5000,
headers: {
'x-client-os-type':'others',
'X-Frontend-Id': 6,
'X-Frontend-Version': 0
},
body : JSON.stringify(
{
"params" : params,
"threadKey":threadKey,
"additionals":{}
}
)
})
.then(response => {
if (response.ok === true) {
return response.json()
} else {
throw new Error("HTTP status code : " + response.status);
}
})
.then(json => {
return json
})
.catch(error => {
console.error(error)
});

}

发表回复

登录以发表回复。