刮.aspx页面中的节点
问题描述:
我一直在努力拼抢以下站点: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);
});
任何有关图书馆的帮助/反馈/建议,将非常感激!谢谢!
答
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,是否适合你更好。
感谢您的回复!我实际上试图查看RSS源,但似乎与其他页面有相同的问题,它返回一个空的主体。它似乎可能是一个失败的原因。 – Mark
尝试在单引号的代码封闭的网址:'scraperjs.DynamicScraper.create(“HTTP://www.fightingillini.com/....”).' –
我一直在试图用刮RSS源正常的请求模块... 'request('http://www.fightingillini.com/calendar.ashx/calendar.rss?sport_id=9',cb1);' 我还在向上空身...感谢所有的帮助 – Mark