This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name YoutubeVideoInfoAdapter | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description YoutubeVideoInfoAdapter | |
// @author You | |
// @grant GM_xmlhttpRequest | |
// @grant GM.xmlHttpRequest | |
// @connect www.youtube.com | |
// @connect googlevideo.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
const root = typeof unsafeWindow !== "undefined" ? unsafeWindow : window; | |
let tokenId = undefined; | |
let updateFunction = undefined; | |
Object.defineProperty(root, "forcePoTokenId", { | |
get: () => tokenId, | |
set: (value) => { | |
tokenId = value; | |
if (typeof updateFunction === "function") updateFunction(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const unrestrictedSanitizer = (string) => string; | |
const unrestrictedPolicy = window.trustedTypes.createPolicy("po#html", { | |
createHTML: unrestrictedSanitizer, | |
createScript: unrestrictedSanitizer, | |
createScriptURL: unrestrictedSanitizer, | |
}); | |
const poRequest = async (endpoint, content) => { | |
const response = await fetch( | |
`https://jnn-pa.googleapis.com/$rpc/google.internal.waa.v1.Waa/${endpoint}`, |