Only small improvements this time of which the largest is using Wikipedia to test queries. I query against the live site, however if you are going to query at a larger scale for longer periods, you should consider for instance downloading the latest dump of the site and using that instead. If no results or too many results are found, I assume that the search phrase is either irrelevant or too broad.
The following snippet shows how to search Wikipedia:
import wikipedia from joblib import Memory memory = Memory(cachedir='.') @memory.cache def search_wiki(phrase): return wikipedia.search(phrase)