从MATLAB Web浏览器保存HTML页面 [英] Saving html page from MATLAB web browser

查看:355
本文介绍了从MATLAB Web浏览器保存HTML页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题,我在检索到的页面上收到一条消息,内容为"您的浏览器不支持JavaScript,因此某些功能可能会丢失!"

Following this question I get a message on the retrieved page that "Your browser does not support JavaScript so some functionality may be missing!"

如果我在MATLAB Web浏览器中使用web(url)打开此页面并接受证书(每个会话一次),则该页面将正确打开.

If I open this page with web(url) in MATLAB web browser and accept certificate (once per session), the page opens properly.

如何使用脚本从浏览器保存页面源?还是从系统浏览器?还是即使没有浏览器也有办法获取该页面?

How can I save the page source from the browser with a script? Or from system browser? Or may be there is a way to get that page even without browser?

url='https://cgwb.nci.nih.gov/cgi-bin/hgTracks?position=chr7:55054218-55242525';

推荐答案

根据我的判断,可以很好地下载页面源代码,只需确保在本地打开保存的页面时运行Javascript.

From what I could tell the page source gets downloaded just fine, just make sure to let Javascript run when you open the saved page locally.

[...]
<script type='text/javascript' src='../js/hgTracks.js'></script>
<noscript><b>Your browser does not support JavaScript so some functionality may be missing!</b></noscript>
[...]

请注意解决方案您只使用下载网页,而没有任何附件(图像,.css,.js等).

Note that the solution you are using only downloads the web page without any of the attached stuff (images, .css, .js, etc..).

您可以做的是调用wget来获取包含所有文件的页面:

What you can do is call wget to get the page with all of its files:

url = 'https://cgwb.nci.nih.gov/cgi-bin/hgTracks?position=chr7:55054218-55242525';
command = ['wget --no-check-certificate --page-requisites ' url];
system( command );

如果您使用的是Windows计算机,则始终可以从GnuWin32项目或许多其他实现方式.

If you are on a Windows machine, you can always get wget from the GnuWin32 project or from one of the many other implementations.

这篇关于从MATLAB Web浏览器保存HTML页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆