PDA

View Full Version : Load RSS/Atom Data Using Google API



mrnap
26 Jan 2011, 9:23 AM
I'm working on building an RSS reader using Sencha Touch. I've been looking for the most efficient method of adding/pulling feed data, and the best bet I found so far is to use the Google Feeds API (http://code.google.com/intl/nl/apis/feed/v1/devguide.html#load_the_javascript_api_and_ajax_search_module), which returns feeds in a JSON format.

This API uses code similar to the following format to initialize and then load the feed, and it also says it requires an asynchronous callback to process the results from the server, something like this:


var feed = new google.feeds.Feed("myfeedurlhere");
feed.load(); //Can have an optional callback inside load()

function onFeedLoad() {
//do stuff for after load here, maybe insert to Sencha model?
}

google.setOnLoadCallback(onFeedLoad);


My question is, assuming I've already setup correctly dependent models, what is the best way to use this API to get data into my Sencha Touch models? Is including it in an external js file and calling that as my proxy the best idea, or is there a more efficient way to do it in my main app js (which I would prefer)?

Also, would this API be the easiest/most efficient option for pulling an RSS feed from a URL, or is there a better way for me to hand code something with Sencha Touch or another scripting language?

Thanks!

mrnap
26 Jan 2011, 5:24 PM
Would it be better to store it in a variable and access the variable directly through no proxy?

Or would it be better to call it as a JS function when loading the store?

mrnap
26 Jan 2011, 7:03 PM
Found a way to do it using a URL request, but still looking for a better way.

URL:
http://www.google.com/uds/Gfeeds?callback=google.feeds.Feed.RawCompletion&context=0&num=10&hl=en&output=json&q=YOUR_URL_HERE&v=1.0&nocache=0