Skip to main content

I needed to retrieve the first two posts from a Facebook page's wall, and decided against using a full-feature plugin for such a small request. Since direct loading of cross-domain RSS feeds is not permitted and I want to avoid using proxies, Yahoo Pipes was the best solution. I created a Pipe using its 'Fetch Feed' module, and simply let it load the Facebook RSS feed URL. From the generated link, I was able to treat the URL like a local file.

/*Using Yahoo Pipes' 'Fetch Feed' feature to enable cross-domain RSS parsing: */
var itemsToFetch = 2;

//this is the url generated by Pipes
var rssURL = "";

    type: "GET",
    url: rssURL,
    dataType: "xml",
    success: function (xml) {
        //create an ul in the empty #feed-holder <div>
        for (i = 0; i < itemsToFetch; i++) {
            var $rssItem = $(xml).find('item:eq(' + i + ')');
            var title = $rssItem.find('title').text();
            var link = $rssItem.find('link').text();
            var date = $rssItem.find('pubDate').text();
            $('#feed-holder ul').append('<li> <a href="' + link + '" target="_blank"><div class="linkbox"><img src=""/><div class="fb-date">' + date + '</div><div class="fb-title">' + title + '</div></a></li>');