Bring freshly updated content to web site - rss

What technology can be used on my website to bring in daily fresh updated content, like News RSS feed from a famous news website,... etc?

[Update - General answer]
As you already mention, RSS feeds are your best way to get updated news. They are easily consumable and provide a standard interface for article based data. For example CNN has their top storries at http://rss.cnn.com/rss/cnn_topstories.rss. When browsing news sites with Firefox it will display a RSS icon in the addressbar if the site has RSS feeds, which makes it easier to discover feeds.
Since you tag this as C# and ASP.Net I will answer it in terms of coding.
Many news sites offer RSS feeds and these can be consumed with the SyndicationFeed class introduced in .Net 3.5. The SyndicationFeed class supports both Atom 1.0 and RSS 2.0.
The most important part when consuming feeds in my opinion is to cache them, so that you don't download the feed for every hit on your web page. Where you get your feed from depends on what topics you want and where in the world you are located.
Here's a short example.
// Check cache for data
IEnumerable<SyndicationItem> items = Cache["NewsFeed"] as IEnumerable<SyndicationItem>;
if (items == null)
{
// Not in cache, go get it!
try
{
SyndicationFeed news = SyndicationFeed.Load(XmlReader.Create("http://www.news.corp/feed.xml"));
items = news.Items;
}
catch
{
items = new List<SyndicationItem>();
}
// Add the items to the cache
Cache.Insert("NewsFeed", items, null, DateTime.Now.AddHours(1.0), TimeSpan.Zero);
}
// Bind your data somewhere

Related

RSS feed link doesn't open up reader or just dumps out raw XML

I developed an RSS feed following a tutorial and I think the .xml file itself is in order. However, I have two problems:
When people click on the RSS link, it doesn't automatically load into their RSS readers
For those that don't have an RSS reader, clicking the link results in a page full of code which is not very understandable
I was hoping that there might be some tips on how to easily realize this.
Try to remove the <![CDATA[ and ]]> in the description tag.
I downloaded your xml, changed those lines, tested it on my server, and it worked in google's rss reader.
This is a browser and user profile dependent issue in how the RSS link is going to react when clicked on.
If the user has the action set up to automatically load it into their feed reader of choice, it will do that.
If they don't, then it won't.
For those that just see a raw dump, it could be that they're using a browser that does not support RSS feeds and will dump out the XML as raw text. Google Chrome (at least still in version 18) without the use of extensions or add-ons will usually be the dump truck culprit here.

How to create an RSS feed?

How do I create an RSS feed in ASP.NET?
Actualy I want to output like this. Clik on an RSS icon, open the RSS bookmark box and subscribe the user. After that, clik on the RSS feed link, create RSS bookmark to show RSS, update data.
At the end of the day an RSS feed is an XML document that adheres to a predefined schema. So in the simpliest terms all you need to do is populate that XML and make it accessible to web users. You can also put information in the head of your web page markup to inform the browser that an RSS feed is available to them (this is optional).
You have a couple of options depending on the .NET framework version you are using:
.NET 2 : Get hold of the RSS XML schema you want to work with and populate as you would with any XML document.
.NET 3.5 : 3.5 introduced System.ServiceModel.Syndication, this wraps up the various RSS formats that are available and makes the process of creating your feed much easier. An example of working with these classes can be found here:
http://predicatet.blogspot.com/2009/05/create-rss-feed-natively-with-net-35.html
More information on the Syndication namespace can be found here:
http://msdn.microsoft.com/en-us/library/system.servicemodel.syndication.aspx
Finally, as you develop your feed you can use the following to validate your XML:
http://validator.w3.org/feed/

Naive question about implementing RSS

I have a naive question about RSS feeds.
I have a series of timed events which appear on my site and that I make available as an RSS feed for other applications to import.
Who is typically responsible for truncating this feed? Over the next year, I can see my feed having thousands of items. Should the URL mysite.com/rss always return all items? And leave it to the readers to just show the most recent? Or is it more customary that I only return, say, the top 50? Expecting the readers to cache older items? (And, if so, is there a convention for readers to ask the server for the "next page")?
What is the typical behaviour of something like FriendFeed when it pulls in an RSS stream?
You should return only top few. Readers are supposed to save older items. Readers also usually ask for the feed many times a day, so you'll want to keep its size low to save bandwidth. If someone wants to browse your archives they'll typically do its via our web site. RSS is mostly for syndication of new items.

How to play audio podcast file from libsyn rss feed? (drupal)

Got an established libsyn rss feed, got a new drupal website for the podcast. Libsyn provides a player but not correct aesthetic. I can upload and play mp3 files with audio module and mp3player module, and like the mp3 player's output, a simple flash player, but I don't want to be manually moving the podcast audio files (mp3) over every week. Looked at importing automatically with Feeds, but it's not working and besides that's creating extra files unnecessarily on the drupal site.
Just want to use the mp3player modulee's flash player in a drupal page, which feeds the latest mp3 file from a libsyn rss feed. Don't really need to store or play multiple episodes, just the latest episode.
How would you do it?
Create a content type for my podcasts with a title and a field for the URL of the MP3
Use FeedAPI and map the title to the title of the node
Map the file URL to the URL field
Use Contemplate to set the URL field to display as [swf file="token_for_URL_field"], which will use the SWF Tools module and whatever player I've selected to play the file
So you need these modules CCK, Contemplate, FeedAPI, and SWF Tools, and that should do the trick.
Why don't you have your own site be the master and libsyn get it from you? Do they not allow an import feature, with which you'd keep your existing RSS through them. Then you can have total control over your site and push the content to all kinds of other great podcasting networks.
Realize I may have no idea about libsyn works.
When you say feeds didn't work, how did it fail? Are you using feed mapper? You may need to write a custom plug-in for feed mapper to get it to do the right thing with the video files. Feed api supports expiring imported feed items so you should be able to get it to automatically delete old ones. I'm not sure whether the video files will be automatically deleted when the nodes are. If not, you should be able to make this happen by implementing nodeapi's delete op for the content type you are using to store your imported rss items.
Alternatively, maybe you could just harvest the video's url on libsyn, and have the player use that. I don't know whether there's a good player which supports using a field's data for the location of the source it should play.
Also, if you haven't already, I'd encourage you to post your question on groups.drupal.org since that's read by lots of drupal experts.

Collecting RSS Feeds Online?

I'd like to be able to collect RSS feeds online as an alternative to collecting them on a desktop machine using a regularly running process.
Ideally, it would either collect all feeds and simply email them to a single address as soon as it finds a new one (or even without checking for new feeds) or aggregates all the smaller feeds and sends them out as a bulk larger feed less periodically.
It would have to run on a web server continually, but would be a nice to be able to collect all feeds, not just the ones I happen to pick up when a feed reader is running on my machine. Is something like this available?
Just use Google Reader. :)
Google Reader.
Maybe Yahoo's Pipes could help you. It is an interesting way of combining and manipulating feeds.
I'm not sure if you have ever used it but iGoogle allows you to customise the google homepage to display information from around the web. You can add tabs to the page to allow you to split the information up. It's extremely useful and as you can log into it from any computer / browser you can access your feeds anywhere.
If you have a lot of feeds of one type or feeds that update infrequently then iGoogle can also be combined with google reader.
It's also great for adding other plugins like gmail, games, Dilbert :) and more.
To create an iGoogle page go to the google home page and click the iGoogle link in the top right corner. iGoogle will then provide you with a starter page and some suggested content which you can add or ignore. If you click the "Add Stuff" link then "Add feed or gadget" you can manually add all your RSS feeds. However, you can also configure Firefox to automatically select google as your RSS reader when ever you click on an RSS feed icon in the navigation bar. You can select / change this under Tools -> Options -> Applications -> Web Feed.
In order to use your iGoogle on multiple browsers / computers you will need a gmail / google account however it's free and easy to create.
T
simplepie is great if you have PHP installed.
Universal Feed Parser if you're programming in python might be of help

Resources