我正在尝试使用 Scrubyt 从该页面http://www.nuffieldtheatre.co.uk/cn/events/event_listings.php?section=events获取详细信息。我已经设法从列表中获取标题和详细 URL,但我无法使用 next_page 让刮刀转到下一页。我认为这是因为我没有为下一页链接使用正确的模式。我尝试了字符串“Next Page”,也尝试了 XPath。还有其他想法吗?
代码如下:
require 'rubygems'
require 'scrubyt'
nuffield_data = Scrubyt::Extractor.define do
fetch 'http://www.nuffieldtheatre.co.uk/cn/events/event_listings.php?section=events'
event do
title 'The Coast of Mayo'
#url "href", :type => :attribute
link_url
end
next_page "Next Page", :limit => 2
end
nuffield_data.to_xml.write($stdout,1)