Search code examples
htmljsonyahoo-pipes

Yahoo Pipes HTML Tables to JSON object array


I'm trying to use Yahoo Pipes to turn multiple tables inside a DIV into an array of JSON objects.

Below is what I currently have. The HTML is being parsed fine.

enter image description here

http://pipes.yahoo.com/pipes/pipe.edit?_id=cbd57c80e76b0a2973df0e8bbc357820

I want each of the table cells to be properties of of the JSON object. I believe this is possible with looping, however I can't figure out how to make this happen.

enter image description here


Solution

  • I figured this out using pure JS and the YQL API.

    var yql_query = 'select * from html where url="http://www.scorespro.com/soccer/england/premier-league/2014-2015/standings/"';
    yql_query += " and xpath='//*[@id=\"standings_1a\"]'";
    yql_query = 'http://query.yahooapis.com/v1/public/yql?q=' + encodeURIComponent(yql_query) + '&format=html&callback=?';
    
    $.getJSON(yql_query, function (data) {
    
        // do something crazy the power is now yours! $(data.results[0])
    });