来自Javascript的RSS feed的结果

时间:2015-12-05 17:44:38

标签: javascript rss

我尝试使用RSS Feed从Scotrail Journeycheck网站获取RSS Feed。我正在获取一个列表OK,但它只显示没有实际信息的延迟服务,并且不会像Journeycheck页面那样延伸到Departure和Arrival时间。例如,这显示了拉格斯到格拉斯哥。我将这段旅程称为Journeycheck并复制RSS链接。

<html>
<head>
<script type="text/javascript" src="http://www.google.com/jsapi?">
</script>

<script type="text/javascript">
google.load("feeds", "1") //Load Google Ajax Feed API (version 1)
</script>
</head>

<body>
<div id="feeddiv"></div>
</body>
</html>
<script type="text/javascript">

var feedcontainer=document.getElementById("feeddiv")
var feedurl="http://rss.journeycheck.com/scotrail/route?action=search&  from=LAR&to=GLC&period=today&formTubeUpdateLocation=&formTubeUpdatePeriod=&savedRoute="
var feedlimit=150
var rssoutput="<b>Scotrail Planner:</b><br /><ul>"

function rssfeedsetup(){
var feedpointer=new google.feeds.Feed(feedurl) //Google Feed API method
feedpointer.setNumEntries(feedlimit) //Google Feed API method
feedpointer.load(displayfeed) //Google Feed API method
}

function displayfeed(result){
if (!result.error){
var thefeeds=result.feed.entries
for (var i=0; i<thefeeds.length; i++)
rssoutput+="<li><a href='" + thefeeds[i].link + "'>" + thefeeds[i].title + "</a></li>"
rssoutput+="</ul>"
feedcontainer.innerHTML=rssoutput
}
else
alert("Error fetching feeds!")
}

window.onload=function(){
rssfeedsetup()
}

</script>

0 个答案:

没有答案