...

View Full Version : Javascript for reading RSS...



chamith7
08-24-2005, 07:41 PM
It would be very cool to be able to use javascript to act as an rss reader, and I made up a very quick, very wrong script that gives the gist of what I am going for.

Is it possible to succeed with a script like follows (fake methods are bold)
(Bear in mind one problem already is that the same link and title would be returned every time, but that is an easy fix):

function getTitle()
{
scanPage="http://rss.news.yahoo.com/rss/topstories";
if(page.find(<title>)
{
while(page.find=!</title>)
{
var contents = String.scan;
}}
return contents
}

function getLink()
{
scanPage="http://rss.news.yahoo.com/rss/topstories";
if(page.find(<link>)
{
while(page.find=!</link>)
{
var contents = String.scan;
}}
return contents
}

for (i=0; i<10; i++)
{
document.write("<A HREF=\"" + getLink() + "\">" + getTitle() + "</A>");
}


Because this would be a much simpler way to display an RSS feed on your site instead of using server-side stuff like perl. I realize Javascript may not have the methods for this, but what if you integrated Java into it. At least that way my search functions would exist. I don't know much about implementing Java in Javascript or an elegant way of implementing this idea. What do you think, is this tenable?

nikkiH
08-24-2005, 08:00 PM
Well, I think it's already been done, if I understand what you're asking.

http://www.google.com/search?hl=en&q=rss2js&btnG=Google+Search]

chamith7
08-24-2005, 08:22 PM
I appreciate that, since I did not know the convention "rss2js" but I will still like to tackle this, and at least this way I wouldn't be dependent on the server of those sites that will deliver the feed to you, and I could customize it a lot more to fit my needs.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum