简体   繁体   English

如何在nodejs中获取web api(没有lib)

[英]how to get web api in nodejs (without lib)

I am making a module that converts html to json in node environment.我正在制作一个在节点环境中将 html 转换为 json 的模块。 I would like to know how to access web browser api from node.我想知道如何从节点访问 web 浏览器 api。 How can I access document object with nodejs only without libraries such as cheerio and jsdom?如何在没有诸如cheerio和jsdom之类的库的情况下仅使用nodejs访问文档object? (I used Google Translate, sorry) (我用谷歌翻译,抱歉)

Node.js does not have built-in support for rendering HTML documents. Node.js 没有对呈现 HTML 文档的内置支持。

It doesn't execute JavaScript that it extracts from <script> elements inside an HTML document.它不执行从 HTML 文档中的<script>元素中提取的 JavaScript。

It has no native document object.它没有原生document object。

If you want one you either need to build it yourself or use a third-party library.如果你想要一个,你要么需要自己构建它,要么使用第三方库。

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

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