diff --git a/search_with_lepton.py b/search_with_lepton.py index 75c9ee2..3c494f4 100644 --- a/search_with_lepton.py +++ b/search_with_lepton.py @@ -3,6 +3,7 @@ import json import os import re +import uuid import threading import requests import traceback @@ -136,6 +137,10 @@ def search_with_google(query: str, subscription_key: str, cx: str): json_content = response.json() try: contexts = json_content["items"][:REFERENCE_COUNT] + for item in contexts: + item['url']=item['link'] + item['name']=item['title'] + item['id']=str(uuid.uuid4()) except KeyError: logger.error(f"Error encountered: {json_content}") return []