2008-10-03 31 views
0

我正在嘗試使用Scrubyt從此頁獲取詳細信息http://www.nuffieldtheatre.co.uk/cn/events/event_listings.php?section=events。我已經設法從列表中獲取標題和詳細URL,但我無法使用next_page讓刮板進入下一頁。我認爲這是因爲我沒有爲下一頁鏈接使用正確的模式。我嘗試了字符串「Next Page」,並且我也嘗試了XPath。任何其他想法?如何獲得Scrubyt的「下一頁」鏈接

的代碼如下:

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) 

回答

2

一個稍微不同的URL試試這個:

fetch 'http://www.nuffieldtheatre.co.uk/cn/events/event_listings.php' 

scrubyt似乎有與問題上的最終查詢「一節=事件?」 URL。

當它看起來它試圖返回此URL下一頁:

http://www.nuffieldtheatre.co.uk/cn/events/?pageNum_rsSearch=1&totalRows_rsSearch=39&section=events

代替:

http://www.nuffieldtheatre.co.uk/cn/events/event_listings.php?pageNum_rsSearch=1&totalRows_rsSearch=39&section=events

刪除查詢字符串的URL的末尾似乎解決了這個問題 - 你可能想把這個文件作爲一個bug。

相關問題