Pārlūkot izejas kodu

Catch empty Google results properly.

tags/v0.3
Ben Kurtovic pirms 8 gadiem
vecāks
revīzija
fbb9ea7b03
1 mainītis faili ar 5 papildinājumiem un 1 dzēšanām
  1. +5
    -1
      earwigbot/wiki/copyvios/search.py

+ 5
- 1
earwigbot/wiki/copyvios/search.py Parādīt failu

@@ -161,7 +161,11 @@ class GoogleSearchEngine(_BaseSearchEngine):
except ValueError:
err = "Google Error: JSON could not be decoded"
raise SearchQueryError(err)
return [item["link"] for item in res["items"]]

try:
return [item["link"] for item in res["items"]]
except KeyError:
return []


class YahooBOSSSearchEngine(_BaseSearchEngine):


Notiek ielāde…
Atcelt
Saglabāt