(2015-11-11, 01:45)CaptainT Wrote: (2015-11-10, 20:52)spoyser Wrote: However, just tried a search for Eastenders and got the dreaded infinite spinning "working".
I'm guessing a regex somewhere is getting stuck.
I can't verify this right now. However, how long did you wait for a result? Search is known to take very long, usually at least 20-30 seconds even on high-end computers. If you are using something like Raspi 1 it may take more than a minute to complete.
45 minutes and still spinning
The fetching of the html on my machine is less than 1 second so it isn't that, it is definitely the regex that is at fault.
A poorly constructed regex can take an age to perform, and just because a regex works doesn't mean it is efficient. I well crafted scrape of a page can be orders of magnitude faster than a poorly designed one, and I mean maybe 90 seconds down to 5 seconds (funnily enough that I observed that on one of the other iPlayer addons).
I would suggest looking at the use of the split function, this can be used to break the html down into small manageable chunks of text that a regex can parse much more efficiently.
To be honest the whole scrape should only take a few seconds once the html has been fetched (assuming only one page needs to be fetched).
Also I had a very quick look at your code, and a
Code:
while True:
try:
#do stuff
except:
break
Isn't the best, 'while True' is virtually always a bad idea, especially when you are relying on the throwing on an exception to break out of it.
(It isn't that that which is causing the failing search though)