2017-10-07 115 views
0

由于Google在其末尾做了一些更改,因此我的股票报价无法正常工作。我已阅读此链接上的信息 google finance json stock quote stopped working但它没有帮助。股票报价 - Google财经(2017年9月6日后更改)

之前获取信息的URL是这个 https://finance.google.com/finance/info?client=ig&q=而且我们知道它不再有效。

以下是我的代码。请有人请提供帮助!

var gstock = ["BOM:500209", "PPY:000001"]; 
for (var i = 0; i < gstock.length; i++) { 
    $.getJSON("https://finance.google.com/finance?client=ig&q=" + gstock[i] + "&callback=?", function (response) { 
     var stockInfo = response[0]; 
     var stockString = '<div class="stockWrapper"> '; 
     stockString += '<span class="stockDirectionValue' + getGlyph(stockInfo.cp) + '"> ' + '</span>'; 
     stockString += '<span class="stockText">BSE:</span>'; 
     stockString += '<span class="stockPrice">' + stockInfo.l + '</span>'; 
     stockString += '<span class="stockChange">' + stockInfo.c + '</span>'; 
     stockString += '</div>'; 
     $('.stockBSE').prepend(stockString); 
    }); 
} 

回答