Ruby Mechanize 检索标头
我正在使用 mechanize 进行网络检查,当我获得 URL 时,我会进行刷新 标题中的 URL:
meta http-equiv="refresh" content="2;url=/html/Splash.action?splash="
当我要求机械化列出元数据时,我这样做:
pp $page.meta
我得到:
Mechanize::Page::Meta
""
"http://localhost/html/Splash.action?splash="
如何干净地检索刷新 URL?
谢谢
I'm using mechanize for web inspection, when I get a URL I get a refresh
URL in the headers:
meta http-equiv="refresh" content="2;url=/html/Splash.action?splash="
When I ask to mechanize to list the metadata I do this:
pp $page.meta
I get:
Mechanize::Page::Meta
""
"http://localhost/html/Splash.action?splash="
How can I cleanly retrieve the refresh URL?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这有效:
This works:
要么是 mechanize 中的错误,要么是 html 有问题,因为它应该有 this is meta。
顺便说一句,Mechanize 还有 #follow_meta_refresh 属性,默认情况下为 false。
Either it's a bug in mechanize, or there's something wrong with the html, as it should have this is meta.
BTW, Mechanize also has #follow_meta_refresh attribute, which is false by default.