Trying to get RSS from Yahoo! Finance based on answers from Andrew and Dylan Valade in Parse RSS with jQuery but receiving an error:
data.responseData is null
success() data = Object { responseDetails="Feed could not be loaded.", responseStatus=400, responseData=null}
Loading the same URL from the browser or PHP cURL returns the RSS data ok
url: http://feeds.finance.yahoo.com/rss/2.0/headline?s=^FTSE, url encode: http%3A%2F%2Ffeeds.finance.yahoo.com%2Frss%2F2.0%2Fheadline%3Fs%3D%5EFTSE
Testing from local vhost on my Mac (OS X 10.5.8, XAMPP 1.7.3). I tried zRSSfeed plugin wich also use Google API, and received the same error: "Feed could not be loaded". Index data and chart are working fine
Thanks in advance
function getRSS(symbol, url, callback) {
$('#rss').html('http://feeds.finance.yahoo.com/rss/2.0/headline?s='+symbol+'<br />');
$('#rss').append(encodeURIComponent(url));
$.ajax({
url: document.location.protocol + '//ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=10&callback=?&q=' + encodeURIComponent(url),
dataType: 'json',
success:
function (data) {
callback(data.responseData.feed);
},
error:
function (jqXHR, textStatus, errorThrown) {
$('#rss').append('<span class="downVal">'+textStatus+'</span>');
$('#rss').append('<br />'+'<span class="downVal">'+errorThrown+'</span>');
}
});
}
function parseRSS(newsFeed) {
$('#rss').append(newsFeed);
}
jQuery(document).ready(function($) {
...
summary(symbol);
$('#chart').html('<img style="-webkit-user-select:none" src="http://chart.finance.yahoo.com/z?s='+symbol+'&t=3m&q=l&l=on&z=m&p=m20,m200,v&a=r14,m26-12-9">');
getRSS(symbol, 'http://feeds.finance.yahoo.com/rss/2.0/headline?s='+symbol, parseRSS);
...