AJAX - querying a search engine and returning the number of results

Posted by Moddy on Stack Overflow See other posts from Stack Overflow or by Moddy
Published on 2010-03-29T02:00:31Z Indexed on 2010/03/29 2:03 UTC
Read the original article Hit count: 368

Right, so basically I need to query a selection of search engines in an AJAX app. As there is a number of different search engines - there's no search engine specific API I can use either. My main problem is getting the number of results returned by the search.

So far, I have decided it is probably best to use a regexp from the returned search query HTML, and then convert the string of characters to an integer. However, this method just doesn't feel.. clean to me. It seems a bit rough around the edges and I think it could do with improving! I guess not being 100% confident with regular expressions doesn't help; but it just feels like it could be improved.

Any ideas on how to implement this would be great cheers! It doesn't seem like that an exotic thing to do, so I was wondering if perhaps any of you guys have done this before and would have a few tips?

Note: This is an AJAX app at the moment, but I may be re-writing this functionality in a different app soon - which won't be AJAX. I'm confident I can transfer any AJAX implementation to the other language though.

© Stack Overflow or respective owner

Related posts about AJAX

Related posts about searching