From 575592135feeb8b9be2672a22a1e4254dca3a928 Mon Sep 17 00:00:00 2001 From: dgw Date: Fri, 18 Oct 2019 14:49:53 -0500 Subject: [PATCH] search: don't unquote DDG result Bing doesn't need it. Unquoting breaks URLs that contain spaces. This changed in #1265 but it's not clear why. As a bonus, we shed the entire block of py2/py3 shimming for `unquote`. --- sopel/modules/search.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sopel/modules/search.py b/sopel/modules/search.py index f61f5f1ddc..15790f6212 100644 --- a/sopel/modules/search.py +++ b/sopel/modules/search.py @@ -59,8 +59,7 @@ def duck_search(query): bytes = bytes.split('web-result')[1] m = r_duck.search(bytes) if m: - unquoted_m = web.unquote(m.group(1)) - return web.decode(unquoted_m) + return web.decode(m.group(1)) # Alias google_search to duck_search @@ -92,7 +91,7 @@ def duck_api(query): # test for bad Unicode handling in py2 @example( '.duck grandorder.wiki chulainn alter', - 'https://grandorder.wiki/CĂș_Chulainn_(Alter)', + r'https://grandorder.wiki/C%C3%BA_Chulainn_(Alter)', online=True) # the last example (in source line order) is what .help displays @example(