Home
entries friends calendar user info rictus.com Previous Previous Next Next
nj - dear lazyweb: feedburner considered annoying
tritone
[info]tritone
Add to Memories
Tell a Friend
dear lazyweb: feedburner considered annoying
[Update 3/10/2008: FeedBurner no longer seems to be doing this--my app suddenly started working with no changes on my part. Odd.]

When I try to access a FeedBurner feed from my Flex app, FeedBurner decides to hand me an HTML version of the feed, instead of, you know, the frickin' feed. Of course, if I go to the same URL in Firefox, it gives me the right thing. What do I have to do to get FeedBurner to realize that I actually want XML?

[Addendum: I know I can append "?format=xml" to the URL, and I guess I could just automatically add that onto any URLs I get from FeedBurner. But if I go to the base URL from Firefox, FeedBurner knows how to hand it XML; I want to figure out how it's doing that, so my feedreader will work with other sites that try to do the same trick (I've noticed at least one other site doing it).]

Tags: , ,

Comments
jwz From: [info]jwz Date: March 10th, 2008 08:03 am (UTC) (Link)
Well, the only data feedburner has to work with are the headers being sent; so start by sending the same headers as Firefox and trim. Probably it's keying on the user agent, as that would be the maximally stupid thing to do.
From: (Anonymous) Date: March 10th, 2008 08:24 am (UTC) (Link)
But...but...but...that's why I'm asking lazyweb! Because I'm lazy!

Yup, user agent would really be maximally stupid. It would mean that any time someone invents a new feedreader, FeedBurner either has to know about it, or the feedreader has to know about FeedBurner urls. Seems unlikely, but who knows.

If Professor Lazyweb doesn't rescue me, I'll try fiddling with headers tomorrow...
ronebofh From: [info]ronebofh Date: March 10th, 2008 05:26 pm (UTC) (Link)
Yup, user agent was the first thing that came to mind, and because the perversity of the universe tends towards a maximum, it's not even a surprise.
tritone From: [info]tritone Date: March 10th, 2008 05:32 pm (UTC) (Link)
Yup. I was hoping it would be the "Accept:" header, but that doesn't seem to be working (though I'm not totally sure I'm setting the header the right way--it was just a 5-minute test). I'll try user-agent next.
_lj_sucks_ From: [info]_lj_sucks_ Date: March 10th, 2008 06:34 pm (UTC) (Link)

If it's keying on the useragent, it's doing the right thing by default. When I send no user agent info, I get the Atom feed. Here's my test code:

require 'uri'
require 'net/http'

url = "http://feeds.feedburner.com/goodexperience/1"
uri = URI.parse(url)
if uri.query
  path = uri.path + '?' + uri.query
else
  path = uri.path
end
request = Net::HTTP::Get.new(path)
http = Net::HTTP.new(uri.host, uri.port)
response = http.request(request) do |response|
  if response.kind_of? Net::HTTPSuccess
    puts response.body
  else
    puts "Error fetching #{url}: #{response.code} #{response.message}"
  end
end
Link / 5 comments or Leave a comment
profile
nj
User: [info]tritone
Name: nj
Website: rictus.com
calendar
Back May 2009
12
3456789
10111213141516
17181920212223
24252627282930
31
page summary
tags