简体   繁体   English

如何从 inte.net 去除 next.js html

[英]How to deminify next.js html from internet

I'm trying to rebuild a website that I scraped from the web using wget.我正在尝试重建一个我使用 wget 从 web 抓取的网站。 It appears to be a next.js application, as I see the _next folder.它似乎是一个 next.js 应用程序,正如我看到的 _next 文件夹。 I have 0 experience in nextjs and have no idea what the inner workings are, but it seems like it is somehow minifying all the code into a single script.我在 nextjs 方面的经验为 0,并且不知道内部工作原理是什么,但它似乎以某种方式将所有代码缩小到一个脚本中。

Is there any way to "undo" this and make it look like pretty HTML?有什么方法可以“撤消”它并使其看起来像漂亮的 HTML 吗?

Here is what it looks like这是它的样子这是它的样子

目录

Unfortunately this isn't possible, as the HTML you scraped is pre-rendered static HTML by NextJS that's later hydrated by the JavaScript, which resides in the chunks folder.不幸的是,这是不可能的,因为您抓取的 HTML 是由 NextJS 预渲染的 static HTML,后来由位于chunks文件夹中的 JavaScript 混合。

To recreate the website, you'll first have to recreate all the JavaScript that was transpiled into chunks by WebPack or SWC, which is no easy task.要重新创建网站,您首先必须重新创建所有由 WebPack 或 SWC 转译成块的 JavaScript,这不是一件容易的事。 It's laborious and can only be minimally automated, and there's no way to "demangle" code that's been transpiled back into its original form.这很费力,而且只能实现最低限度的自动化,而且没有办法“分解”已经转译回其原始形式的代码。

There might be a better solution to your question if you provide more information about your target and motivation behind doing so.如果您提供更多关于您的目标和这样做背后的动机的信息,您的问题可能会有更好的解决方案。 Otherwise, I'd strongly recommend not spending time trying to reverse transpiled code.否则,我强烈建议不要花时间尝试逆向转译后的代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM