Skip to content

Instantly share code, notes, and snippets.

@piouc
Last active August 11, 2022 14:11
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save piouc/135f3ae165e3bc1322ae0559e166bd1e to your computer and use it in GitHub Desktop.
Save piouc/135f3ae165e3bc1322ae0559e166bd1e to your computer and use it in GitHub Desktop.
nicovideo fake premium
// ==UserScript==
// @name nicovideo fake premium
// @namespace https://piou.dev
// @include https://www.nicovideo.jp/watch/*
// @version 1.2.0
// @grant none
// @run-at document-start
// ==/UserScript==
const observer = new MutationObserver((mutations) => {
for(const mutation of mutations){
for(const node of mutation.addedNodes){
if(node.nodeName !== 'SCRIPT') break
const dataElement = document.getElementById('js-initial-watch-data')
const data = JSON.parse(dataElement.dataset.apiData)
if(data?.viewer){
data.viewer.isPremium = true
dataElement.dataset.apiData = JSON.stringify(data)
}
const headerDataElement = document.getElementById('CommonHeader')
const headerData = JSON.parse(headerDataElement.dataset.commonHeader)
if(headerData?.initConfig?.user){
headerData.initConfig.user.isPremium = true
headerDataElement.dataset.commonHeader = JSON.stringify(headerData)
}
observer.disconnect()
return
}
}
})
observer.observe(document, {childList: true, subtree: true})
@riolove000
Copy link

すみません、これ実行しようとしたら動きませんでした💦
直してくれたりってしますか、、、?

@piouc
Copy link
Author

piouc commented Aug 2, 2021

firefoxのみで動作可能だったものをchromeにも対応させました

@riolove000
Copy link

ありがとうございます……!
コメントの投稿はやっぱりサーバーと通信しちゃうのでプレミアム限定色は使えないんですかね

@piouc
Copy link
Author

piouc commented Aug 2, 2021

これはプレイヤーのプレミアム限定機能の反転再生などを使えるようにするだけなのでコメントの機能に干渉はできないかと思います。

@SAMYEL06
Copy link

動作しなくなった。
修理は可能ですか?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment