Tip for javascript people: parsing xml/rss feeds without php

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fris
    Too lazy to set a custom title
    • Aug 2002
    • 55679

    #1

    Tip for javascript people: parsing xml/rss feeds without php

    I been wanting to parse feeds on a static only site, but usally you have to use a php file to do it, I just realized Google has a feed parsing api, which turns a xml/rss feed into a json object.

    Thought I would pass it along.

    You basically take

    https://ajax.googleapis.com/ajax/ser...main.com/feed/

    it turns the feed into a json object.

    I put up a jsfiddle demo which grabs the google trends.

    Code:
    $(function() {
        $.getJSON('https://ajax.googleapis.com/ajax/services/feed/load?v=1.0&q=http://www.google.com/trends/hottrends/atom/feed?pn=p1&num=-1&callback=?&alt=json-in-script', function(data) { 
            $.each(data.responseData.feed.entries, function(i, item) {
    	    var title = item['title'];
    	    $('#trends').append(title + '<br/>');
            });
        });
    });
    http://jsfiddle.net/7YDLP/

    Hope someone can use this ;)
    Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.
  • livexxx
    Confirmed User
    • May 2005
    • 1201

    #2
    I tend to use the google playground to see what things look like quickly

    http://code.google.com/apis/ajax/pla...eeds#load_feed
    http://www.webcamalerts.com for auto tweets for web cam operators

    Comment

    • freecartoonporn
      Confirmed User
      • Jan 2012
      • 7683

      #3
      thanks, will use it .
      SSD Cloud Server, VPS Server, Simple Cloud Hosting | DigitalOcean

      Comment

      • SDSimon
        Confirmed User
        • Aug 2002
        • 140

        #4
        Thank you fris. I will also be using this.

        >>>Winners WIN because they NEVER GIVE UP!<<<

        Comment

        • SeanLEE
          Confirmed User
          • Feb 2006
          • 1556

          #5
          Wow.,,, The Grinch is being giving.
          I spammed in threads!

          Comment

          Working...