dアニメでニコニコのコメントを流す
< 脚本nicommentDanime的反馈
コメントはこんな感じのapiで取れますparamsとthreadKeyはニコニコ動画の視聴ページのapiDataにあるデータですconst threadKey = window.opener.NicoCache_nl.watch.apiData.comment.nvComment.threadKeyconst params = window.opener.NicoCache_nl.watch.apiData.comment.nvComment.paramsconst 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) });}
登录以发表回复。
コメントはこんな感じの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)
});
}