PDA

View Full Version : RSS feeds using YQL stopped working



dannwebb
08-28-2017, 12:28 AM
Displaying RSS feeds using YQL, a Google Feed API alternative

http://www.javascriptkit.com/dhtmltutors/yqlfeeds.shtml

This has stopped working, even on the demo page. I only noticed today (29/8/17), but another commenter says it stopped for him on 25/8/17.

Does anyone know if yahoo have stopped supporting this? I read somewhere about 6 months ago (sorry to be vague there) that they may drop it, just as Google dropped their RSS feed api thing which it replaced.

Any help appreciated.
cheers.

jscheuer1
08-28-2017, 02:42 AM
I think it may depend upon what method you're using. Or just be a temporary network issue. The Dynamic Drive script:

http://www.dynamicdrive.com/dynamicindex18/gajaxrssdisplayer.htm*

appears to still work, but it seems spotty. I've had another report from someone using YQL in a completely different environment (Tumbler), where they claimed it was sporadic, but when I checked the page, it seemed fine at the time.


*see also (unofficial update, may be more stable):

http://www.dynamicdrive.com/forums/showthread.php?81161-gAjax-RSS-Feeds-Displayer-SSL-Update

But my thinking is that that, since I cannot easily find any information on it being discontinued, and because all implementations still appear to work, if sporadically, Yahoo hasn't suspended it. Probably just network lag either on Yahoo's end, the feed supplier's end, or just generally. The javascriptkit script demo page wouldn't work for me at first, but later I saw that the Digg feed did come through in Chrome, once, then later the BBC one in Opera, again, once. This is consistent with what the other poster said he saw using Tumbler, though his page was fine when I looked at it.

I'd give it a few days and see if it settles down again. If you do see a report from Yahoo though, saying it's discontinued, please post a link to it.

Oh, and if you have PHP, you can host your own feed fetching code in a variety of ways which would likely be more reliable than anything YQL can offer.

dannwebb
08-28-2017, 04:16 AM
I think it may depend upon what method you're using. Or just be a temporary network issue. ...

Thanks, I appreciate all that information; thanks for taking the time. I'll see what I can do.

I'm in a corporate environment. The Google feed was set up for me by our webmaster, but when Google abandoned it he abandoned me and hasn't offered an alternative, so I used this script myself. We do have PHP, but I'm no programmer (although I've certainly adapted some PHP to suit my needs in the past); HTML and CSS are my areas of real knowledge.

Thanks again.

jscheuer1
08-28-2017, 01:38 PM
Well, for use with PHP, I would recommend:

http://www.dynamicdrive.com/dynamicindex18/rssdisplaybox/index.htm

Or the unofficial but more current:

http://www.dynamicdrive.com/forums/showthread.php?79991-jsjqrssfader&p=317744#post317744

I did have another thought on what the issue with YUI/YQL might be. I recall when I was looking into it before (I did some work on the DD script soon after it had been converted to YUI/YQL and wrote my own slightly different version as well), that there was some mention, or at least I think there was some mention about registering your application. But as everything seemed to work fine at that time, I didn't look too seriously into it. What may have happened though is that Yahoo may have since decided to limit full functionality to those with registration. Usually these sorts of registrations are free, or at least free for the amount of usage the average non-commercial page would need. But if it was required/suggested (which the more I think about it, I think it was), it was unclear to me how to apply it to the DD script. It may be able to be applied to the script in general, or it may need to be applied to each particular use of the script someone puts it to. I'll try to look into this further.

OK, I did that, and was unable to easily find any information about needing to register applications. Perhaps I had imagined it. I did, however, find an official Yahoo announcement that they are terminating active development of YUI dated 8/14! In that announcement they said that they would continue to add fixes/patches essential for "Yahoo properties", but that active development would cease. It's unclear if that has anything to do with the current issues with the YUI/YQL based RSS scripts or not.

The announcement:

https://yahooeng.tumblr.com/post/96098168666/important-announcement-regarding-yui

The official YQL console appears to still be up and in working order:

https://developer.yahoo.com/yql/console/

dannwebb
08-28-2017, 11:38 PM
Thank you again for your response.

It would appear that I'm going to be left without this feed in my medical newsletter .. the SimplePie solution is not an option for me in my situation. I don't have access to modify our PHP environment (the requirements for SimplePie state that some required extensions are not enabled by default, and the wrangling I'd have to go through to get that to happen is not worth my time).

Man .. all I want is to display some health and medical headings and snippets of news on a medical library newsletter .. so complicated.

Looks like I'll be going back to doing it manually :(

jscheuer1
08-29-2017, 01:17 AM
If it's your own site's feed you may be able to use the local feeds displayer. If so I can link you to that.

Also, though it's often common for certain settings not to be the default to allow simplepie to operate, these days, often they are. If the feed isn't local, you should at least try simplepie out. It will save you so much time in the long run if it works.

Finally, for now, I think the problem with YQL may just be temporary. You should try it again in a few days.

dannwebb
08-29-2017, 11:34 PM
I typically display feeds from BBC Health, Reuters Health, CBC Health, MedGadget.com, Science.org .. that sort of thing. Pretty simple, nothing fancy .. just a heading, a snippet, and a link to the story.

It looks like YQL is starting to work again, but it's dodgy.. each time I reload the page some feeds appear, then they don't, then they do .. *sigh*.

I'll have another look at simplepie, and figure out whereabouts in the instructions I can jump in to give it a try (obviously I'll have to skip all the initial setup stuffs).

Thanks very much; I really appreciate your advice.

jscheuer1
08-31-2017, 03:30 PM
OK, I guess this was really bugging me. So I've been messing around with it off and on for a few days. I've discovered the problem is that, even with the most direct method, which I determined to be having a script that has as it's source the the YQL address, followed by the encoded query and the name of a callback function to execute once the script loads, sometimes the query object comes back with 0 results. So I decided to use this as a prompt to repeat the request up to 20 times (well actually 20 times the number of feeds in an instance, but comes out to at least 20 tries per feed), which appears usually more than sufficient to get any given feed in spite of the occasional empty response. In my testing I discovered that one of my test feeds had changed its address and even with its new address was unreliable, so make sure all of your feed addresses are current and reliable (try them out directly in the browser).

I've written this into a script that can be used with:

http://www.dynamicdrive.com/dynamicindex18/gajaxrssdisplayer.htm

Here's the updated script:

http://jscheuer1.com/gfeedcatch/gfeedfetcher-scripttag.js


It no longer requires:


<script src="http://yui.yahooapis.com/3.18.1/build/yui/yui-min.js"></script>

so skip that part of the demo page instruction. In fact in step 1, use just the updated code attached to this post. The rest of the documentation on usage all still applies.

And here's a demo of the new code in action. Still on rare occasion has trouble mostly due to slow connects with the feeds though I think:

http://jscheuer1.com/gfeedcatch/demo.htm

Let me know if you have any questions or problems.

Note: After putting this live I see a slight problem with the last demo (3 feeds in one) sometimes getting crossed up with itself resulting in duplicate entries. I'll have to look into that to see what might be able to be done about it.

OK I think that's fixed now.

After further testing, definitely seems fixed, still works like a charm, and no more misses after about 100 page loads. Tested in IE11 (in IE11 and IE9 modes), latest Firefox, Chrome, and Opera, including tablet and smart phone emulation.

jscheuer1
09-03-2017, 03:45 AM
Oh, and if you want to use something like the javascriptkit code, this works most of the time:


<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

</head>
<body>

<div id="qznews"></div>

<script>
(function(c){
var uniquename = 'qznews' // id of target div
var query = 'select * from rss(0,5) where url = "http://qz.com/feed/"'; // query as explained in original version
var numretries = 30; // increase this number (number of retries) if you're still having problems

//////// No Need To Edit Beyond Here Unless You Want To /////////

var counter = typeof c === 'number'? c : numretries;
var thisf = arguments.callee;
var head = document.getElementsByTagName('head')[0];
var s = document.createElement('script');
window["callback_" + uniquename + (--counter)] = function(r){
head.removeChild(s);
if(r && r.query && r.query.count === 0 && counter > 0){
return thisf(counter);
}
//r now contains the result of the YQL Query as a JSON
var feedmarkup = '<p>';
var feed = r.query.results.item // get feed as array of entries
for (var i=0; i<feed.length; i++){
feedmarkup += '<a href="' + feed[i].link + '">';
feedmarkup += feed[i].title + '</a><br />';
feedmarkup += feed[i].description + '</p>';
}
document.getElementById(uniquename).innerHTML = feedmarkup;
};
var baseurl = "https://query.yahooapis.com/v1/public/yql?q=";
s.src = baseurl + encodeURIComponent(query) + "&format=json&callback=callback_" + uniquename + counter;
head.append(s);
})();
</script>
</body>
</html>

Demo:

http://jscheuer1.com/gfeedcatch/jsk-demo-st.htm

dannwebb
09-04-2017, 12:33 AM
This is great .. thanks so much for your time and effort.

I really have no preference for what to use .. I just want it to work and to be reliable .. "set and forget", yanno ;)

As soon as I have time here at work to have a proper look at this I'll definitely do so. I don't like things randomly disappearing like that; it's not a good look for us, so a change in method is certain.

thanks again.

jscheuer1
09-04-2017, 01:49 AM
Well just as a point of information, the gfeedfetcher update (like the script it's based on) has more built in flexibility, can handle dates and times without your needing to code for that, anticipates future possible glitches, is more modular, but requires slightly more upfront code loading. So, if you're using it a lot (on two or more pages or for several instances on a page), and/or want the flexibility of easily combining feeds, and/or including ATOM feeds, it's the obvious choice. It does require some usage learning, if you're not already familiar with the gfeedfetcher approach.

Then again, if you just want one page and three feeds or less, and want to tailor the callback function(s) (output) in very specific ways, perhaps you would want to go with the JavaScriptKit modification, which can be further modified by you (with or without my help) to deal with specific output requirements and/or any other glitches which may or may not arise. Note that the JavaScriptKit modification could be made modular, so that only one main function would be required for two or more feeds on a page, as long as the output format were the same or similar for all of the feeds. It would be difficult to make it handle ATOM feeds.

Further, both mods have the advantage over their respective predecessors of being able to run on an SSL (htpps/secure) page, which neither of the previous code versions for either script could do.

jscheuer1
09-04-2017, 01:19 PM
Oh, and here's a modular version of the updated JavaScriptKit method:


<!DOCTYPE html>
<html>
<head>
<title>Simple YQL Modular Version</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

</head>
<body>

<div id="qznews"></div>
<div id="nbcnews"></div>

<script>
function parsefeed(cfig, c){
var numretries = 30; // increase this number (number of retries) if you're still having problems

//////// No Need To Edit Beyond Here Unless You Want To /////////

var counter = typeof c === 'number'? c : numretries;
var head = document.getElementsByTagName('head')[0];
var s = document.createElement('script');
window["callback_" + cfig.id + (--counter)] = function(r){
head.removeChild(s);
if(r && r.query && r.query.count === 0 && counter > 0){
return parsefeed(cfig, counter);
}
window.console && console.log(cfig.id + ': ' + counter); // for optional diagnostic info - may be removed or commented out
//r now contains the result of the YQL Query as a JSON
var feedmarkup = '<p>', i = -1;
var feed = r.query.results.item // get feed as array of entries
while (++i < feed.length){
feedmarkup += '<a href="' + feed[i].link + '">';
feedmarkup += feed[i].title + '</a><br />';
feedmarkup += feed[i].description + '</p>';
}
document.getElementById(cfig.id).innerHTML = feedmarkup;
};
var baseurl = "https://query.yahooapis.com/v1/public/yql?q=";
s.src = baseurl + encodeURIComponent(cfig.query) + "&format=json&callback=callback_" + cfig.id + counter;
head.append(s);
}
parsefeed({id: 'qznews', query: 'select * from rss(0,5) where url = "http://qz.com/feed/"'});
parsefeed({id: 'nbcnews', query: 'select * from rss(0,5) where url = "http://feeds.nbcnews.com/feeds/topstories"'});
</script>
</body>
</html>

Underwater
01-04-2019, 03:00 PM
Hi,

Unfortunately, YQL based services will not working anymore.


On Jan. 3, 2019, YQL service at http://query.yahooapis.com will be retired. YQL based services that use http://query.yahooapis.com , including users of http://datatables.org , will no longer operate.

How we can manage this problem? What can we do to keep using gAjax RSS Feeds Displayer?

Thank you in advance.