From 7202fcb391f55391ecc086c64827c25deca94a35 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Wed, 19 Aug 2009 23:00:31 +0200 Subject: [PATCH] movie title searches can do without beeing updated every 24 hours --- oxweb/google.py | 10 +++++----- oxweb/imdb.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/oxweb/google.py b/oxweb/google.py index 1109d05..2362cba 100644 --- a/oxweb/google.py +++ b/oxweb/google.py @@ -28,17 +28,17 @@ google.find(query, max_results) FIXME: how search depper than first page? ''' DEFAULT_MAX_RESULTS = 10 +DEFAULT_TIMEOUT = 24*60*60 -def getUrl(url, data=None, headers=oxlib.net.DEFAULT_HEADERS): - google_timeout=24*60*60 - return oxlib.cache.getUrl(url, data, headers, google_timeout) +def getUrl(url, data=None, headers=oxlib.net.DEFAULT_HEADERS, timeout=DEFAULT_TIMEOUT): + return oxlib.cache.getUrl(url, data, headers, timeout) def quote_plus(s): return urllib.quote_plus(s.encode('utf-8')) -def find(query, max_results=DEFAULT_MAX_RESULTS): +def find(query, max_results=DEFAULT_MAX_RESULTS, timeout=DEFAULT_TIMEOUT): url = "http://www.google.com/search?q=%s" % quote_plus(query) - data = getUrl(url) + data = getUrl(url, timeout=timeout) link_re = r'(?P.*?)' + \ r'.*?(?:
|)' + \ r'(?P.*?)' + '(?:|