2015-07-10 46 views
0

我一直在努力拼搶以下站點:http://www.fightingillini.com/schedule.aspx?path=softball刮.aspx頁面中的節點

我已經使用節點/ cheerio/scraperjs湊過去靜態和動態內容的豐富經驗,但我沒有任何運氣破解這個網站。

 scraperjs.DynamicScraper.create('http://www.fightingillini.com/calendar.ashx/calendar.rss?sport_id=9') 
      .scrape(function() { 
       return $('item').map(function() { 
       return $(this).children('title').text(); 
       }).get(); 
      }, function(list) { 
       console.log(list); 
      }); 

任何有關圖書館的幫助/反饋/建議,將非常感激!謝謝!

回答

0

Asp.Net Web窗體頁可能是出了名的難湊,因爲複雜的ViewState隱藏的表單輸入。有些時候,這是連一個特徵;)

在這種情況下,我會去的RSS源,通過頁面上的鏈接,找到您要刮:

http://www.fightingillini.com/calendar.ashx/calendar.rss?sport_id=9

該鏈接將爲您提供相同的內容,但採用更加友好和標準的XML格式。解析這個代碼可能更容易解析正確。最重要的是,這裏的格式保證爲穩定,而在常規頁面上,即使對網站主題進行了小小的調整,也可能會導致您的解析代碼不可用。

問題是,rss鏈接,在某種意義上,作出刮,所以先看看那裏。

下面是當前條目的一個示例:

<item> 
<title>2/6 11:30 AM [L] Softball vs Winthrop</title> 
<description>L 1-5 http://www.fightingillini.com/calendar.aspx?id=8670</description> 
<link>http://www.fightingillini.com/calendar.aspx?id=8670</link> 
<guid isPermaLink="true">http://www.fightingillini.com/calendar.aspx?id=8670</guid> 
<ev:gameid>8670</ev:gameid> 
<ev:location>Athens, Ga.</ev:location> 
<ev:startdate>2015-02-06T17:30:00.0000000Z</ev:startdate> 
<ev:enddate>2015-02-06T20:30:00.0000000Z</ev:enddate> 
<s:localstartdate>2015-02-06T11:30:00.0000000</s:localstartdate> 
<s:localenddate>2015-02-06T14:30:00.0000000</s:localenddate> 
<s:teamlogo>http://www.fightingillini.com/images/logos/site/site.png</s:teamlogo> 
<s:opponentlogo>http://www.fightingillini.com/images/logos/z16.png</s:opponentlogo> 
<s:links> 
</s:links> 
</item> 

頁也有一個iCal link,是否適合你更好。

+0

感謝您的回覆!我實際上試圖查看RSS源,但似乎與其他頁面有相同的問題,它返回一個空的主體。它似乎可能是一個失敗的原因。 – Mark

+0

嘗試在單引號的代碼封閉的網址:'scraperjs.DynamicScraper.create(「HTTP://www.fightingillini.com/....」).' –

+0

我一直在試圖用刮RSS源正常的請求模塊... 'request('http://www.fightingillini.com/calendar.ashx/calendar.rss?sport_id=9',cb1);' 我還在向上空身...感謝所有的幫助 – Mark