I have a site where feeds are often submitted by users who are not very technically sophisticated. The result is submission of many feeds with invalid or broken URLs or alternatively inputting their blog homepages as feed URLs.
There should be a way to guard against this at the stage of feed submission. Here is what can be done -
1) Checking that URL is syntactically correct (already in place)
2) Check that URL actually points to a valid feed by calling SimplePie
3) If the URL is not a valid feed try RSS auto-discovery to catch most cases when homepage is entered
Validation steps 2 and 3 could be optional and configured globally by admin in SimpleFeed settings. Auto-discovery would work the same way browsers do it by looking for
tag. You can try feed discovery here -
- FF 2: Go to "Bookmarks" -> "Subscribe to Page" menu
- IE 7: Go to "Bookmarks" -> "Feed Discovery" menu
Basic feed auto-discovery is documented by W3C (http://www.w3.org/TR/html4/struct/links.html) and explained by Jeremy Zawodny (http://jeremy.zawodny.com/blog/archives/000967.html), the code for finding feeds on his own blog is the following:
<link rel="alternate" type="application/rss+xml" title="RSS" href="http://jeremy.zawodny.com/blog/rss2.xml" />
So in essence SimpleFeed should have validation code to check that the feed works and try to discover it if need be.
Comments
Comment #1
dkruglyak commentedOne more point. Since most blogging platforms automatically include feed auto-discovery, perhaps there should be a SimpleFeed setting to ask users to enter their homepage URLs (vs. feed URLs) by default - which would be much simpler for end users.
This could be a globlal config setting, configured optionally.
Comment #2
m3avrck commentedI started a similar issue a while back with some psuedo code to check if the URL is even reachable: http://drupal.org/node/183219
I am in favor of improving the feed adding process for the same reasons. SimplePie already has feed discovery built in so we don't have to reinvent the wheel.
To make this feature as simple as possible, I think the following would be best:
1. Check if the URL is valid (already there)
2. Invoke SimplePie to see if it can a feed, if it finds a feed URL that is *different* from entered url (e.g., homepage verse feed page), refresh the page with a validation error "The URL entered appears to have this as the Feed URL, is this correct"? If the user then resubmits the node, save it with this updated URL. That way SimplePie doesn't ahve to autodiscover this URL every time it refreshes the feed (performance) and easier for users to add.
The only caveat to #2 is if a user is trying to add a feed that might be down for whatever reason. In that case, having a global option "Add strong feed detection" with a note of this possible caveat would be good.
I would support this patch going in but dont have time to currently write this myself, but will happily review and commit.
Comment #3
m3avrck commentedNow fixed in 5.x and 6.x