PDA

View Full Version : Error while using gFeedFetcher.js



Ro.
04-02-2014, 11:15 PM
1) Script Title: gFeedFetcher.js / gajaxticker.js

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

3) Describe problem:

Hi I'm having an issue while using the gAjax RSS Ticker (hosted) which uses the following two scripts: gFeedFetcher.js & gajaxticker.js.

Most of the time it works fine and the RSS feed is displayed, but sometimes I get a range of error messages displayed in place of the feed:

1. ERROR: Timed out waiting for data to be extracted. If the problem persists, try simplifying your search patterns.

2. MAXIMUM ERROR COUNT REACHED

3. SSL: Socket Timeout

Can you please help in finding out why these are being displayed?

I am including both scripts in the head of the page and have the following in the body:


<script type="text/javascript">
var newsfeed = new gfeedrssticker( "mni3", "class3", 10000, "_new" )
newsfeed.addFeed( "MNI", "http://feed43.com/mniusdsmall.xml" ) //Specify "label" plus URL to RSS feed
newsfeed.displayoptions( "snippet" ) //show the specified additional fields
newsfeed.setentrycontainer( "li" ) //Display each entry as a paragraph
newsfeed.filterfeed( 5, "date" ) //Show 5 entries, sort by date
newsfeed.entries_per_page( 1 )
newsfeed.init() //Always call this last
</script>

When I check the RSS feed by entering the URL in a web browser it displays fine...

jscheuer1
04-03-2014, 03:28 AM
It's working for me. You say you've included both scripts. There are actually three:


<script type="text/javascript" src="http://www.google.com/jsapi"></script>

<script type="text/javascript" src="gfeedfetcher.js"></script>

<script type="text/javascript" src="gajaxticker.js">

/***********************************************
* gAjax RSS Ticker- (c) Dynamic Drive (www.dynamicdrive.com)
* Requires "gfeedfetcher.js" class
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

</script>


The first is remote hosted by Google. The other two should be in the same folder as your page.

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

Ro.
04-13-2014, 04:03 PM
Hi John, I have included the google script (<script type="text/javascript" src="http://www.google.com/jsapi"></script>), and the feed does display 9 out of 10 times - its just very hard to predict when the error will be displayed without watching the ticker all the time.. sometimes the error will popup for 5 minutes and then go away again.

I have been looking at a workaround by using the Search and replace functionality in gfeedfetcher.js to search for when the error displays and replace it with a more user friendly message. This works fine when using a static ticker and adding in the instance.addregexp rule (e.g. http://www.dynamicdrive.com/dynamicindex18/gajaxrssdisplayer.htm)

However when attempting to get the search and replace functionality to work when using a moving scroller - gajaxticker.js (http://www.dynamicdrive.com/dynamicindex18/gajaxrssticker.htm) it does not seem to work.

The below is my code, where I am attempting to replace the word 'Analysis' in the title field with the word 'Loading...'


<script type="text/javascript">
var newsfeed = new gfeedrssticker( "mni1", "class1", 10000, "_self" )
newsfeed.addFeed( "MNI", "http://feed43.com/mnieursmall.xml" ) //Specify "label" plus URL to RSS feed
newsfeed.displayoptions( "snippet" ) //show the specified additional fields
newsfeed.setentrycontainer( "li" ) //Display each entry as a paragraph
newsfeed.filterfeed( 5, "date" ) //Show 8 entries, sort by date
newsfeed.entries_per_page( 1 )
newsfeed.addregexp(/(Analysis)\b/ig, 'Loading...', 'titlefield')
newsfeed.init() //Always call this last
</script>

Does gajaxticker.js need to be modified in some way so that it picks up the instance.addregexp rule?

Thanks

jscheuer1
04-15-2014, 03:22 PM
OK, I was trying this again for you and got the error on the uero feed. I then tried contacting the feed directly and got:

"Server is experiencing heavy load. Please try again in a few minutes"

or something very close to that. It's what the server sends out when it cannot send the feed. The message you are getting though is from Google, it's server's response to the above response from the feed server. This is made worse because Google caches responses so will show the feed as down for longer than it actually is.

I would suggest, if you have PHP on your server, using an alternative script like:

http://www.dynamicdrive.com/dynamicindex17/rsspausescroller/index.htm

for which there's an unofficial update (works better on more modern feeds/servers):

5424

I suggest this because although it would have a similar problem because it caches the feeds as well, they are cached on your server and you control for how long. But it requires that your host have PHP available to you to process the feed.

As to your other question, yes. The gajaxticker.js script would have to be changed as the code in the fetcher script that uses the regEx's isn't used by the ticker script. So, if you want to remain with these scripts and get a custom error message (as I think you've guessed, it's the title field), use this version which implements the regEx's (right click and 'Save As'):

5428

Ro.
04-16-2014, 11:55 PM
Thank you for investigating the cause of the error, I don't have PHP enabled on my web server at the moment but will look to get it setup.

The script which you modified is working great, however when I have tested using the new gajaxticker.js (and also infact gFeedFetcher.js for static feeds) using the search and replace functionality, it is working to modify strings in the title of real news items - but when it comes to the error messages which are displayed, the regEx rule seems to be ignored even though the error message is displayed in the title field.

Do you know why this would be?

jscheuer1
04-17-2014, 02:17 AM
No. In fact I tried it with the updated gajaxticker.js script and the:


ERROR: Timed out waiting for data to be extracted. If the problem persists, try simplifying your search patterns.

error using:


newsfeed.addregexp(/(Error)\b/ig, 'Loading...', 'titlefield')

Which made it:


Loading... Timed out waiting for data to be extracted. If the problem persists, try simplifying your search patterns.

So it did work for that. What regEx(s) did you use? I did not try it without the updated gajaxticker.js script, so I cannot verify that it would work with only gfeedfetcher.js.

Ro.
04-17-2014, 10:48 AM
Really, that's great to hear it worked!

I was testing only the static ticker with gfeedfetcher.js, using the following regEX:

newsfeed.addregexp(/(ERROR: Timed out waiting for data to be extracted. If the problem persists, try simplifying your search patterns.)\b/ig, 'Loading...', 'titlefield')

I will try out the above rule with the new gajaxticker.js, but if it worked for you i'm sure it will be fine to replace the whole error string for a moving ticker.

Do you think that the logic in the search and replace in gfeedfetcher.js is different?

jscheuer1
04-17-2014, 01:06 PM
I'm pretty sure it is. I looked at it as a sort of guide as to how to implement it in the gajaxticker script. I didn't like the code, so I changed it. And where it is used in the fetcher script is in a function that's not used in the ticker script. So I had to implement it in a function of the ticker script. But that's no guarantee that the logic is different. In fact it can't really be all that different, or it wouldn't work. It's just a question of when and under what circumstances it's employed. If you're still having a problem, it's probably that the RegEx you're using doesn't match the text you want to change. If you're still having problems though, let me know. I will try testing your exact RegEx.

Looking at your RegEx I would get rid of the \b part. It's redundant at best. At worst, since it follows a period and precedes the end of the string, it cannot technically be a word border. In that case it wouldn't match. It doesn't, I just tested it. Get rid of the \b in it. Then it should work. Does in testing here with the string. I will have to wait for the actual error to be certain.

Ro.
04-17-2014, 02:54 PM
I've removed the \b now and will wait for the error message to appear to see if it replaces it...

Thanks again for your help its very much appreciated :)

Ro.
04-18-2014, 11:21 AM
ok I've tested and the regex search and replace is working on both scripts gfeedfetcher.js and gajaxticker.js for replacing the error messages in the title field

Ro.
04-23-2014, 11:57 PM
Would you be able to help me out with constructing a regular expression, so that I can capture and replace every ERROR message with a single rule?

All of them which are thrown start with the message "ERROR: .........."

So far I have the following but it doesn't seem to be working:


newsfeed.addregexp(/^ERROR.*$/, 'Loading...', 'titlefield')

jscheuer1
04-24-2014, 03:19 AM
That would do it unless there's preceding whitespace and/or formatting (preceding and/or trailing) from HTML, either of which which there might be. Try:


newsfeed.addregexp(/\s*ERROR: [^<]*/, 'Loading...', 'titlefield')

Ro.
04-24-2014, 02:04 PM
Thanks I'll give it a go

jscheuer1
04-28-2014, 03:42 PM
I was playing around with this over the weekend and discovered a better RegEx - one that's less prone to false positives. I also was playing around with the idea of being able to add transitions. A byproduct of that was I noticed that with the custom ERROR message, sometimes the ticker area was blank, and that the added code allowed for a way to prevent that from happening. So, using the updated code:

5439

I changed:


newsfeed.addregexp(/\s*ERROR: [^<]*/, 'Loading...', 'titlefield')

to:


newsfeed.onitemload = function(item){if(!item){this.feedcontainer.innerHTML = '<a href="" class="titlefield">Loading...</a>';}};
newsfeed.addregexp(/^\s*ERROR: .*$/, 'Loading...', 'titlefield')

Ro.
06-01-2014, 09:53 PM
Sorry for the very late reply, I was just preparing to launch the site live and was still having a couple of issues with the replacing of some of the error messages, and checked back in on the thread.
The new code you have posted is working like a charm and the 'Loading...' message is now static which is a much better visual, thanks again :)

a331005
07-11-2015, 08:23 AM
I dont know if its the right place to ask... But i could not find another discussions dealing with this topic.

I use feed43 and then proxy it through feedburner to push feeds into my Flym news reader (android). Even after being a paid customer there's very limited support from the feed43 website itself.

Now a days i get this "ERROR: Timed out waiting for data to be extracted. If the problem persists, try simplifying your search patterns." When I check the feed in the browser there's no problem; all feeds show fine and theres no error feeds. It happens only in phones which are connected to internet through the day. Theres no ERROR feeds in phones that fetches once in a while, say twice a day.

Wheres the problem? Is it with feed43? Is there a way i can get rid of this annoying error feeds. Any help in this regard is greatly appreciated.