Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果我需要访问/单击的页面超过 1 个,使用ruby/mechanize/nokogiri访问/单击所有页面的最佳方法是什么?例如这里 第 1 页,共 34页 我应该单击页码还是下一步?或者有没有更好的解决方案?
看起来链接“>”会将您带到下一页,如果您在最后一页,它不会出现。所以:
page = ... # fetch the first page loop do # process the page break unless link = page.link_with(:text=>'>') page = link.click end
你应该试试scrubyt。它被描述为“类固醇机械化”。它具有点击页面的专用方法。