使用 Mechanize for Ruby 屏幕抓取 Akamai 的控制面板 - Cookie 问题
我试图从 Akamai 的控制面板中截取一些数据,但在通过 mechanize for Ruby 登录页面时遇到问题。
require 'rubygems'
require 'mechanize'
agent = Mechanize.new
url = 'http://control.akamai.com'
page = agent.get( url )
puts page.content
检查页面后,我发现显示:
"Cookie support has been disabled in your browser. Please enable cookies before continuing."
该页面认为我已禁用 cookie,这会阻止我登录。有什么想法吗?
I am attempting to screen scrape some data from Akamai's control panel, but I am having trouble while logging in to the page via mechanize for Ruby.
require 'rubygems'
require 'mechanize'
agent = Mechanize.new
url = 'http://control.akamai.com'
page = agent.get( url )
puts page.content
Upon examining the page, I find displayed:
"Cookie support has been disabled in your browser. Please enable cookies before continuing."
The fact that the page thinks I have cookies disabled prevents me from logging in. Any thoughts?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以指定其他用户代理:
或者/并手动创建 cookie:
有关 Ruby Mechanize cookie 的更多信息,请阅读此页面:
http://mechanize.rubyforge.org/Mechanize/Cookie.html
http://mechanize.rubyforge.org/Mechanize/CookieJar.html
You can specify other user agent:
Or/And create a cookie manually:
For more info about Ruby Mechanize cookies, read this pages:
http://mechanize.rubyforge.org/Mechanize/Cookie.html
http://mechanize.rubyforge.org/Mechanize/CookieJar.html