简体   繁体   English

在 JavaScript 上获取网页的 HTML 源代码

[英]Get the HTML source code of a web page on JavaScript

I'm building an application and I need to get the html code source of a web page in order to parse it (this web page is not on my server).我正在构建一个应用程序,我需要获取网页的 html 代码源才能解析它(此网页不在我的服务器上)。

I'm coding in Javascript and I can't find a way to do it, I know there is a way to do it in Python (with requests library) and I want basicaly the same thing in Javascript.我正在用 Javascript 编写代码,但我找不到一种方法来做到这一点,我知道有一种方法可以在 Python(使用请求库)中做到这一点,而且我想要在 Javascript 中实现基本相同的事情。

Does someone know how to do this ?有人知道怎么做吗?

Thanks谢谢

尝试这个

document.documentElement.outerHTML

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

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