mirror of
https://github.com/th3r00t/pyShelf.git
synced 2026-04-28 01:59:35 -04:00
Reformed ddg api call
This commit is contained in:
@@ -9,6 +9,7 @@ class DuckDuckGo:
|
||||
|
||||
def __init__(self):
|
||||
self.url = "https://api.duckduckgo.com/?q="
|
||||
self.imageurl = "https://duckduckgo.com"
|
||||
|
||||
def image_result(self, query):
|
||||
"""
|
||||
@@ -26,7 +27,8 @@ class DuckDuckGo:
|
||||
except ValueError:
|
||||
image_result = ""
|
||||
if search_result.status_code == 200 and image_result != "":
|
||||
image = requests.get(search_result.json()["Image"], stream=True)
|
||||
image_result = self.imageurl + image_result
|
||||
image = requests.get(image_result, stream=True)
|
||||
image.raw.decode_content = True
|
||||
return image.raw
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user