PDA

View Full Version : gAjax RSS Feeds Displayer v2.1 - Atom feeds arent shown



esq
01-19-2017, 12:35 PM
1) Script Title: gAjax RSS Feeds Displayer v2.1 (hosted)

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex18/gajaxrssdisplayer.htm

Question:

I was use old version of gAjax RSS Feeds Displayer (that used Google's Ajax Feed API to host) and then Atom and RSS feeds worked fine. I updated the script to v2.1 (using Yahoo YQL to host) but it cant fetching ATOM feeds. I tried a few ATOM feed URLs, but diplaying only blank area, also retrieving icon doesnt seems. The script only displaying RSS feeds, but not ATOM feeds like old versions. How can i fetch and display ATOM feeds with this script?

Thank you!

jscheuer1
01-19-2017, 09:33 PM
OK, I had a heck of a time finding an atom feed to test this on. Seems a lot of them are going out of business. But if you have valid ones (test that by going direct to them in the browser to see if they show up), this may work, or it may need further tweaking. It worked on the two ATOM feeds I tested it on. Their structures were pretty different. I also studied the W3C standards for ATOM to clarify any ambiguities. First use this updated version of the script:

6077

The usage is the same whether you want to use ATOM or RSS or a combination of both or either, with one IMPORTANT CHANGE. If you have one or more ATOM feeds in a feed grouping (even if it's the only feed in that instance), you must add the feed type to it's instance.addFeed function, like so


<script type="text/javascript">

var freeform=new gfeedfetcher("example2", "example2class", "")
freeform.addFeed("Free Form", "http://www.freeke.org/ffg/index.atom", "atom") //Specify "label" plus URL to feed, optional feedtype (defaults to 'rss')
freeform.addFeed("CSS Drive", "http://www.cssdrive.com/index.php/news/rss_2.0/") //Specify "label" plus URL to feed, optional feedtype (defaults to 'rss')
freeform.displayoptions("date snippet") //show the specified additional fields
freeform.setentrycontainer("li") //Display each entry as a list (li element)
freeform.filterfeed(10, "date") //Show 10 entries, sort by date
freeform.init() //Always call this last

</script>

Notice the highlighted.

If you have any problems let me know. It would be helpful to have a link to your page though so I can see what's happening and can test the feeds that you're using.

NOTE: Some ATOM feeds and some items in a given ATOM feed may use xhtml for the the description with no fallback to plain text or html. For those that do it that way I've included an experimental xhtml object parser routine (the YUI interface turns everything into objects) that's clearly marked in the script. The results it gives are not ideal, but I think they're better than no descriptions at all for those items/feeds - that is if the description field is even desired for that feed. If you would rather have no descriptions for those items, simply comment out the routine or remove it. If on the other hand you would rather have it for some feeds and not others, simply do not include descriptions at all on the ATOM feeds you don't want using it. More fine tuning is possible I suppose. Let me know of any requirements you might have there, I will also update the code if anything of value in this or any other regard strikes me.

esq
01-20-2017, 08:31 AM
Hello,
It working now without any problems (So, i didnt see any problems).

Many thanks for help!
Regards.

ddadmin
01-20-2017, 09:09 PM
Great work John! I'll look at possibly integrating your changes into the official build, if there's enough demand for displaying atom feeds.

jscheuer1
01-21-2017, 10:54 PM
OK, great DD! Let me know because I'm still playing around with it a bit. I've already made some slight improvements to the version attached above.

jscheuer1
01-23-2017, 11:19 PM
Made some updates, I think you might want to switch to this new version anyway as in addition to adding ATOM and improving how that is handled over the version attached earlier in this thread, it also has some general improvements. The code is a little longer, but most likely makes up for that in efficiency/modularity. From the comments section:


// Unofficial update Jan 23rd, '17(jscheuer1): Add and improve capability to process ATOM feeds, routines to complete main (title)) links
// from feeds if they're relative, more options and tweak result of limitlength()*, add linktarget to all links in a feed/feed group,
// distribute uneven filterfeed() 'number to show' more evenly, preserve for possible subsequent inits all regex's used on fields and
// feed added via addregexp(), (previously only regex's used on the entire feed were preserved), add feedwritten function. add test to
// see if target div already exists allowing the initial function to be recalled on the same element, tidy up code a bit
// -------------------------------------------------------------------

/* limitlength() still works mostly as originally designed. New options - even if the entry is already short enough, all tags
can still be stripped from the field if a third parameter is set to true, ex:

instance.limitlength(175, 'descriptionfield', true)

Instead of providing a number limit, one can opt for the keyword 'strip'. If one does so, the
result is that tags are stripped from the field but no limit is imposed, ex:

instance.limitlength('strip', 'descriptionfield')

Also, slightly changed is that the test to see if the limit is applied is now the on screen length of the unstripped text,
rather than the unstripped length, which it did before and if done that way could sometimes result in shorter entries
than desired, or unecessary stripping, HTML tags* add no length to text on the screen, but do add a lot to the string
length. By removeing them and replacing non-breaking spaces with spaces, we can get a truer screen length of the text.

* other than images, no way to measure them until they load. They can be set display none or sized in style,
or strippred separately with regex feature.
*/


That last bit on exactly what was done to limitlength() can be removed once the demo page instructions reflect the changes. Here's the script:

6080

ddadmin
01-24-2017, 07:42 PM
Thanks John for the update! I'll give it a test drive this weekend.

jscheuer1
01-24-2017, 10:02 PM
Let me know if you see any problems, should be easy to deal with. Oh, and I forgot to mention, though I hope you remember that in the addFeed function, if it's an ATOM feed, the third parameter 'atom' must still be set (as in the original attached script in this thread), ex:


freeform.addFeed("Babblefish", "http://bblfish.net/blog/blog.atom", "atom") //Specify "label" plus URL to feed, optional feed type (defaults to "rss" - "atom" is the other option)

ddadmin
01-31-2017, 05:18 AM
Just testing gajaxfeeder.js for compatibility with the two other scripts that use it:

http://www.dynamicdrive.com/dynamicindex18/gajaxrssticker.htm
http://www.dynamicdrive.com/dynamicindex18/gajaxpausescroller.htm

For the date field, it's displaying as invalid date. Can you maybe shed light on why? :)

jscheuer1
01-31-2017, 03:48 PM
Yes. I changed:


thisfeed[i].publishedDate = thisfeed[i].pubDate || thisfeed[i].publishedDate || thisfeed[i].date // try to locate date entry

to:


thisfeed[i].ddpublishedDate = thisfeed[i].published || thisfeed[i].pubDate || thisfeed[i].publishedDate || thisfeed[i].date || thisfeed[i].updated // try to locate date entry

That of course necessitated changing it everywhere else it was used in gfeedfetcher.js. But if it's used elsewhere in other functions in other scripts, as I see it is, it needs to be changed there as well. I did this because publishedDate is already a possible property of a feed, and I didn't want to overwrite it. I also did this with title (feeds[i].title is now feeds[i].dditemtitle), that won't effect how feeds with text titles are read, because you were reading title directly from the feed title without changing it. I created dditemtitle to store the text representation of titles in those ATOM feeds (as they are optionally allowed to and often do) that store their titles as objects in the YUI returned data without overwriting those. It also holds the text title from the other feeds, but as I say, those can still be accessed directly from title as well, as they currently are in the two other scripts. I can go over those two other scripts and make the changes if you like. And double check no other potential glitches from changed nomenclature exist. Most others, if any, would only arise when reading an ATOM feed that's doing something in a way that RSS feeds don't.

I can actually change those other two scripts to make them compatible with either version of gfeedfetcher.js - so they still work with the old version and also with the new.

jscheuer1
01-31-2017, 06:18 PM
OK, all set, here are the new files for those other two scripts:

6089

6090

Mmm, but now that I've looked at these two scripts, I've found a fairly easy way to add the regex functionality to them for description, title, and/or full feed. I also noticed that the stripping of tags (as is done when limiting characters), if done to the title field, will strip the links, so I changed that to only strip tags from the title itself. And I see that stripping tags from the description in that manner will strip the br tag that the formatting function itself puts in there, so changed that to preserve the formatting. I'm not completely finished with these additional changes but will have them shortly. I changed the regexprules array to an object in order to do this, so the gfeedfetcher script changes slightly as well. Usage is the same though.

jscheuer1
02-02-2017, 10:01 PM
Now I've really got it. Here's a zip with all the new files, up to date. They're all cross compatible with the older versions, though some features might not work unless all of the latest versions are used, but at least there should be no errors. New features include regex across all three scripts. Only title, date, and description fields can be singled out in the scroller and ticker. All three scripts can use regex on the entire feed. The gefeedfetcher script has availability of each field as originally designed for it as regards regex. Previous updates to gfeedfetch that I made are maintained and extended to the scroller and ticker:

6093

ddadmin
02-03-2017, 07:52 AM
Awesome, thanks so much John! I've done a preliminary test run of the updated .js files across the 3 scripts, and they seem to work without issues. I'll double check everything this weekend, then post the new .js files to the site. Is there any glaring documentation that needs to be updated btw?

jscheuer1
02-03-2017, 01:20 PM
Glaring, no. But I think the we should let folks know the extra capabilities of:


limitlength() still works mostly as originally designed. New options - even if the entry is already short enough, all tags
can still be stripped from the field if a third parameter is set to true, ex:

instance.limitlength(175, 'descriptionfield', true)

Instead of providing a number limit, one can opt for the keyword 'strip'. If one does so, the
result is that tags are stripped from the field but no limit is imposed, ex:

instance.limitlength('strip', 'descriptionfield')

And that, of course if one is using an ATOM feed, it must be specified in the addFeed entry:


freeform.addFeed("Babblefish", "http://bblfish.net/blog/blog.atom", "atom") //Specify "label" plus URL to feed, optional feed type, defaults to "rss" - "atom" is the other option

Finally, we should let them know that for the ticker and scroller they can now use addregexp(). The usage is the same as with gfeedfetcher. But in the scroller and ticker they're limited to using it on titlefield, datefield, descriptionfield, or on the entire feed (as in fetcher, by not specifying the field).

But I don't think any of that is essential, except maybe the part about needing to specify 'atom' for an ATOM feed.

Also added are routines that more evenly distribute an uneven number of 'items to show' over the selected feeds, and ones to detect the base url of the feed and use it to complete the feed's items' links if it's determined they're relative links. Another change is that regexps added via addregexp() for specific fields are no longer deleted when used. So they are available to be reused with a subsequent init() or however one might choose.

I also just added an update to my updated gfeedfetcher-prot.js file that detects earlier versions of the ticker and scroller scripts and enables them to work with it (not miss the date):

6094

ddadmin
02-09-2017, 10:24 PM
Thanks again John for all your work, I've updated the three scripts to use the new .js files, plus updated the documentation for each script accordingly:

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

oscardd
02-09-2017, 11:28 PM
Hello

I have the same issue the script is not fetching any longer because according to my hosting provider is due to this: "This API is officially deprecated and will stop working after December 15th, 2016." See our deprecation policy in our Terms of Service for details. Even in your site the script doesn't work anymore it just displays the image: Retrieving RSS feed(s). Is Dynamic drive aware of this? Please tells what to do I am at a lost here I have 12 sites with so many pages that uses your RSS feed script! on of the sites is this one: http://browseshopbuy.com/automobile-industry-informational-web-page
with all do respect
Oscar Medina

jscheuer1
02-10-2017, 01:39 AM
Hello

I have the same issue the script is not fetching any longer because according to my hosting provider is due to this: "This API is officially deprecated and will stop working after December 15th, 2016." See our deprecation policy in our Terms of Service for details. Even in your site the script doesn't work anymore it just displays the image: Retrieving RSS feed(s). Is Dynamic drive aware of this? Please tells what to do I am at a lost here I have 12 sites with so many pages that uses your RSS feed script! on of the sites is this one: http://browseshopbuy.com/automobile-industry-informational-web-page
with all do respect
Oscar Medina

Use the updated script(s) that have now been added to the Dynamic Drive library, replacing the ones that used to use the now deprecated API.

If you want more help, please let us know specifically which DD script(s) you're using and provide a link to the page on your site that shows the problem.

jscheuer1
02-10-2017, 02:04 AM
Thanks again John for all your work, I've updated the three scripts to use the new .js files, plus updated the documentation for each script accordingly:

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

Thanks DD! Two minor things I noticed:

1.) I did add the regex functionality to the two sister scripts (scroller and ticker), but omitted labelfield as an option since the label is set in the addFeed function and it seemed superfluous to alter an item that's completely under the script's user's control to begin with. It's not a big deal. I doubt many will even try to use that for either the scroller or ticker - still works for the fetcher script. But I can add it to those (scroller and ticker) or you can remove it from their documentation, or we can just let the mystery be - something for us to deal with in the forums. As I say, not a big deal, unless you think so.

2.) With gfeedfetcher.js only, there was added an instance.feedwritten() function. This fires just after the feed or feed group is written to the page, as opposed to when it's initialized (instance.onfeedload), which fires before the DOM part of the feed is written. - Again, no big deal, something very few users would want and can be dealt with/explained in the forums if it arises.

Just wanted you to know. Everything else looks great! If I notice anything else important or otherwise (both of which I think doubtful), I'll let you know.

oscardd
02-10-2017, 09:51 PM
Hello,

I am testing here: tiendanovios.com is fetching some of it; images are missing, description.

What I did? I was told to just upload the new getfeedfether and to replaced the api reference.

jscheuer1
02-10-2017, 10:35 PM
I see that the gajaxticker.js script you're using is not only the old version, but a really old version. My suggestion would be to update to the current version of that script as well (right click and 'save as'):

gajaxticker.js (http://dynamicdrive.com/dynamicindex18/gajaxticker.js)

Use that instead of your current gajaxticker.js script.

The browser cache may have to be cleared, and/or the page refreshed to see changes. Let me know if there are still problems.

ddadmin
02-11-2017, 08:28 PM
Thanks for the heads up John on those two points! Like you said, they will probably be non issues for most users, so I'll just let them be for now. :)

oscardd
02-11-2017, 09:51 PM
Hello

Thank you very much for your help! It works great again!

Foundas
02-12-2017, 05:38 PM
Hello team,

I am trying to use the script but it doesn't work. I checked the script here: http://www.dynamicdrive.com/dynamicindex18/gajaxrssdisplayer.htm but I see it's not loading the RSS either (none of 3 windows work)

Can you please advice

Thanks in advance

jscheuer1
02-12-2017, 05:48 PM
It's working for me. Do you have javascript enabled?

If you want more help, please post a link to the page on your site that contains the problematic code so we can check it out.

Foundas
02-12-2017, 06:09 PM
Hi John,

I am visiting the http://www.dynamicdrive.com/dynamicindex18/gajaxrssdisplayer.htm
I tried with IE, FF, chrome...none show the rss..it just shows the spinning gif and "Retrieving RSS feed(s)"
I do have javascript enabled on the browsers

jscheuer1
02-12-2017, 06:49 PM
OK, unless you have javascript disabled in all those browsers, it's something else. In fact, if you're seeing the loading image, javascript is probably enabled. I assure you that page is working for me in a number of browsers. I've emptied my cache to make sure I didn't just have a past working version loaded. So, the page is up and running. I have found that some third party anti-virus/anti-malware programs as well as firewalls can sometimes block content and/or certain javascript actions. There are other possibilities. If you're using a proxy server that might be an issue, but might not. Try temporarily disabling any third party utilities like I mentioned if you have them. If you're using a proxy to make you browsing private, try temporarily disabling that. Do not change your actual proxy settings if they're merely set to their defaults or you have never manually configured them before.

Just to rule out an issue with feeds in general on your computer, see if you can navigate directly to a feed in - say FF or Chrome (IE is weird with these sometimes all on its own):

http://rss.slashdot.org/Slashdot/slashdot

You should either see the feed or a bunch of xml code.

Also, what version of Windows are you using?

Foundas
02-14-2017, 07:45 AM
Hi John,

I visited the link today and I now I can see the feeds. I have not disabled anything on malwarebytes nor Microsoft essentials (win7 64-bit)
I tested the new yahoo api and it works fine

I don't know if you did any change the scripts, but everything is working now

Thank you

jscheuer1
02-14-2017, 02:37 PM
OK, I'm using the same OS and nothing was changed on Dynamic Drive, as it was working before, and I assume still is. I have no control of the demo page. If you changed nothing and now it works, perhaps you had an older version of the page, one using the deprecated API, cached. That or network connectivity was poor when you were trying before. My best guesses. As long as it's working now, I guess it doesn't matter, and we may never know for sure.

Alcaine
08-15-2019, 04:08 PM
Hello,

The script don't works anymore?

Thank you