# Catching non-RSS/Atom feeds when using Feed-Normalizer

**URL:** <https://www.ruby-forum.com/t/catching-non-rss-atom-feeds-when-using-feed-normalizer/153976>\
**Category:** Rails\
**Created:** [November 24, 2008, 8:43am UTC](https://www.ruby-forum.com/t/catching-non-rss-atom-feeds-when-using-feed-normalizer/153976 "2008-11-24T08:43:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![chunkyslink](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f0a364/32.png) [@chunkyslink](https://www.ruby-forum.com/u/chunkyslink)\
**Post date:** [November 24, 2008, 8:43am UTC](https://www.ruby-forum.com/t/catching-non-rss-atom-feeds-when-using-feed-normalizer/153976/1 "2008-11-24T08:43:11Z")

</div>

A production app is using FeedNormalizer in an rss daemon. The worker  
opens a ‘Source’ (the apps naming convention for an RSS feed), parses it  
using FeedNormalizer, and does the business on the items in the feed;

feed = FeedNormalizer::FeedNormalizer.parse open(source.rss\_url)

A beta tester added a URL, rather than an RSS/Atom URL, and the worker  
choked (on screen prompts have since been cleared up, but that’s not  
enough). I see two options, but I don’t know how to implement either;

1. Validate against anything that isn’t RSS/Atom, or one of the  
recognised ‘feed’ formats which we can parse using feednormalizer

Or, the better option from a usability perspective,

1. The RSS worker catches any errors when FeedNormalizer tries to open  
the source.rss\_url, and, if it isn’t an RSS URL, tries to find any RSS  
feed associated with the ‘source.rss\_url’ the user provided.

I’m happy to go with the first option (as a stop-gap) if someone knows  
of a regex which can be used to validate against a non-feed url (my  
limited experience with rss formats suggests this is unlikely). If you  
think I should go with the second option, I can probably work out how to  
catch the errors from FN but it would be great to know if anyone has a  
snippet for taking a URL and attempting to find a feed on it. Any  
suggestions?

---

<div class="post-metadata">

**Author:** ![chunkyslink](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f0a364/32.png) [@chunkyslink](https://www.ruby-forum.com/u/chunkyslink)\
**Post date:** [November 27, 2008, 2:08pm UTC](https://www.ruby-forum.com/t/catching-non-rss-atom-feeds-when-using-feed-normalizer/153976/2 "2008-11-27T14:08:13Z")

</div>

No thoughts on this one?
