Last active
July 31, 2024 17:03
-
-
Save lubieowoce/06198859dd2cb13687b54b002cd8ac30 to your computer and use it in GitHub Desktop.
Extract the RSC payload from the HTML of a Next.js site
This file contains hidden or 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 env = { self: {} }; | |
const chunks = Array.from(document.body.querySelectorAll("script")) | |
.filter((s) => !!s.textContent && s.textContent.includes("self.__next_f")) | |
.forEach((s) => new Function("self", s.textContent)(env.self)); | |
return env.self.__next_f | |
.filter((c) => c[0] === 1) | |
.map((c) => c[1]) | |
.join(""); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment