YQL Uncaught TypeError: Cannot read property 'channel' of null

YQL Uncaught TypeError: Cannot read property 'channel' of null

下午好。

网站:www.barona.com/beat-the-heat/

YQL 错误:'Uncaught TypeError: Cannot read 属性 'channel' of null'

我最近没有进行任何编辑。看起来像是 yahoo ql 或 YQL 的问题。在其他测试站点上出现相同的错误,并看到人们发布了相同的内容。有人知道一个简单的修补程序吗?请尽可能详细说明步骤。提前致谢! :)

http://www.onextrapixel.com/2011/08/22/adding-weather-to-your-site-with-jquery-and-yql/ 你可以看到他们的演示不工作: http://www.onextrapixel.com/examples/jquery-yql-weather/

HTML:

<img src="/wp-content/uploads/2015/09/featured-BTH-promo.jpg" width="1110" height="360" class="alignnone size-full wp-image-4222" style="width: 100%; max-width: 100% display: block;" />

When it’s 95 degrees out at Barona, get inside and Beat the Heat at Barona where our Loose Troop will give away 3x points on slots, keno, and video poker! Once it hits 95 degrees, you’ll earn 3x points till Midnight! Barona Casino is ALWAYS the COOLEST place to be!
Be sure to add Lakeside, CA to your Yahoo! weather app on your iPhone or Android phone to see current weather conditions in Lakeside, CA.
</br>
<div class="eventBlurb">
<div id="wxWrap">
<span id="wxIntro">Current temperature at Lakeside, CA:</span><span id="wxIcon2"></span><span id="wxTemp"></span>
</div>
</div>
</br>
<small>Multiplied points are applicable toward cash back, and are not applicable toward comps or greater Club Barona tier status.</small>
</br>
<p style="text-align: left;"><a class="btn aply_player" href="/wp-content/uploads/15SE271_GenericPointMultiplier_RulesSheet.pdf" target="_blank">View promotion rules</a></p>

JS:

$(function(){

    var loc = '92040'; 

    var u = 'f';



    var query = "SELECT item.condition FROM weather.forecast WHERE location='" + loc + "' AND u='" + u + "'";

    var cacheBuster = Math.floor((new Date().getTime()) / 1200 / 1000);

    var url = 'http://query.yahooapis.com/v1/public/yql?q=' + encodeURIComponent(query) + '&format=json&_nocache=' + cacheBuster;



    window['wxCallback'] = function(data) {

        var info = data.query.results.channel.item.condition;

        $('#wxIcon').css({

            backgroundPosition: '-' + (61 * info.code) + 'px 0'

        }).attr({

            title: info.text

        });

        $('#wxIcon2').append('<img src="http://l.yimg.com/a/i/us/we/52/' + info.code + '.gif" width="34" height="34" title="' + info.text + '" />');

        $('#wxTemp').html(info.temp + '&deg;' + (u.toUpperCase()));

    };



    $.ajax({

        url: url,

        dataType: 'jsonp',

        cache: true,

        jsonpCallback: 'wxCallback'

    });



});

我想说这不起作用的原因是因为 YQL API 被破坏了,这是他们必须在最后添加的东西。它也大约偏离 10 度和过时的温度。我们最终使用了更准确的东西。