Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jan 2004
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Javascript for reading RSS...

    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?

  • #2
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts
    Well, I think it's already been done, if I understand what you're asking.

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

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/

  • #3
    New Coder
    Join Date
    Jan 2004
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •