Web Hosting Talk







View Full Version : RSS feed


elekt
05-29-2006, 09:30 PM
I am looking to create a script that takes in a google rss feed and creates news story snippets. Specifically takes in a rss feed and creates the html for the story title, a short description and a link to the full story. Are there any free premade scripts out there?

I dont want a script that uses source on a remote server, like many of the ones i have found. I want to be able to manipulate the script to change the formatting and such

THANKS IN ADVANCE! :lovewht:

portalplanet
05-29-2006, 09:36 PM
Hi. Will this do what you're looking for? http://lastrss.webdot.cz/ I have used that in the past.

Justin

dantistus
05-30-2006, 05:26 AM
Hey, it sees to me that you can write a simple script yourself for that?

JBelthoff
05-30-2006, 10:59 AM
I am looking to create a script that takes in a google rss feed and creates news story snippets.

I thought that Google RSS news feeds already contain the HTML in the feed.

So you just have to parse the RSS and grad the Description element.

:peace:

elekt
05-30-2006, 12:58 PM
Hey, it sees to me that you can write a simple script yourself for that?

God I hate pointless posts like this. Why would I ask if I could do it so simply?

JBelthoff
05-30-2006, 01:28 PM
Elekt,

Unfortunately Google RSS Feeds produce varying HTML output in the description element. See here: http://news.google.com/news?hl=en&ned=us&q=web+hosting&ie=UTF-8&output=rss

This changes depending on a number of variables such as if there is a photo in the feed and other things.

It would be hard to come up with a script that can handle all of the different output variations to strip out the information that you want. Besides I think if you don't use the feed as is it may violate the Google terms of service.

If you could tell us exactly what you want out of that feed I could probably help you better.

:peace:

elekt
05-30-2006, 04:32 PM
basically i just want the story title, a description, date and time posted and the link to the full story

JBelthoff
05-30-2006, 04:43 PM
Well with Google News RSS there is a problem.

You can get the Title, Link, and PubDate but they put HTML in the description field. And its not always valid HTML either.

Unless you know every conceivable output variation in that HTML output, you will be hard pressed to find a script that strips a good description out of Google's HTML because it varies so much.

There are other news feeds that make it easier. Moreover perhaps...

:peace:

elekt
05-30-2006, 04:45 PM
I could parse a file and grab the appropriate tags pretty easily. I guess what I really needed to ask was, how do I make it so that the server runs this once a day to genereate teh days news nad does not eat up processing power and bandwidth by generating new RSS content for every visitor.

JBelthoff
05-30-2006, 04:55 PM
Oh..

That's different. You just need to cache the information some place.

In Asp you would do it in the application state. In Asp.Net you would do it in the httpcontext.cache.

I'm not too certain how to do it with PHP or other scripting but there must be cache variables.

Than after a certain amount of time you go a grab the new info and store it into the cache again.

What scripting are you using?

elekt
05-31-2006, 05:10 PM
I don't know what scripting to use yet. I have decided that I want the feed to be parsed etc client side. I dont want the server taking that load. I found a few javascripts that do it but they are not that easily customizable.

JBelthoff
05-31-2006, 05:25 PM
If you choose to do it only on the client side, anyone who has javascipt turned off will not see it.

If you want all of your visitors to see it, do it server side and serve up plain HTML.

:peace: