fix google parser, and by that imdb id lookup, fixes #1545

This commit is contained in:
j 2013-05-31 22:05:25 +02:00
parent cb3701d3e2
commit 8038b0d13f

View file

@ -31,9 +31,7 @@ def find(query, max_results=DEFAULT_MAX_RESULTS, timeout=DEFAULT_TIMEOUT):
data = read_url(url, timeout=timeout)
results = []
data = re.sub('<span class="f">(.*?)</span>', '\\1', data)
for a in re.compile(
'<a href="(\S+?)" class=l .*?>(.*?)</a>.*?<span class="st">(.*?)<\/span>'
).findall(data):
for a in re.compile('<a href="(htt\S+?)".*?>(.*?)</a>.*?<span class="st">(.*?)<\/span>').findall(data):
results.append((strip_tags(decode_html(a[1])), a[0], strip_tags(decode_html(a[2]))))
if len(results) >= max_results:
break