From 643cee56d25e0de38f99e3a71fec3d8844a9888b Mon Sep 17 00:00:00 2001 From: Swee Date: Sat, 5 Oct 2024 15:06:13 -0700 Subject: [PATCH] Update search --- cc/search | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/cc/search b/cc/search index ddd3b43..0de89fd 100644 --- a/cc/search +++ b/cc/search @@ -1,9 +1,11 @@ from duckduckgo_search import DDGS from sys import argv -print("Please stand by...") -request = DDGS().text(" ".join(argv[3:])) -for i in range(0,3): - try: - print(request[i]["href"] + " ⁜ " + request[i]["title"] + " ⁜ " + request[i]["body"]) - except: - break +try: + request = DDGS().text(" ".join(argv[3:])) + for i in range(0,3): + try: + print(request[i]["href"] + " ⁜ " + request[i]["title"] + " ⁜ " + request[i]["body"]) + except: + break +except duckduckgo_search.exceptions.RatelimitException: + print("DuckDuckGo was rate limited, please try again later.") \ No newline at end of file