duckduckgo: fix parsing due to HTML change - frontends - front-ends for some si… | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 7a1838d494e6bcfef16149a4423022d38356b0bc | |
parent 07a5a89d2c8b3dab2fc85ff616e98d34b0edcd21 | |
Author: Hiltjo Posthuma <[email protected]> | |
Date: Sun, 25 Oct 2020 13:34:44 +0100 | |
duckduckgo: fix parsing due to HTML change | |
instead of looking at the prefix uddg= search for the needle, because the | |
prefix was changed to "//duckduckgo.com/l/?uddg=". | |
Diffstat: | |
M duckduckgo/duckduckgo.c | 8 +++++--- | |
1 file changed, 5 insertions(+), 3 deletions(-) | |
--- | |
diff --git a/duckduckgo/duckduckgo.c b/duckduckgo/duckduckgo.c | |
@@ -131,6 +131,8 @@ xmldataentity(XMLParser *x, const char *d, size_t dl) | |
void | |
xmltagend(XMLParser *x, const char *t, size_t tl, int isshort) | |
{ | |
+ char *p; | |
+ | |
if (!isresult) | |
return; | |
@@ -148,9 +150,9 @@ xmltagend(XMLParser *x, const char *t, size_t tl, int issho… | |
isurl = 0; | |
if (!strcmp(t, "div")) { | |
/* decode url and remove "tracking"/usage part via DDG */ | |
- if (!strncmp(result.url, "uddg=", sizeof("uddg=") - 1)) { | |
- if (decodeparam(result.urldecoded, sizeof(result.urlde… | |
- result.url + sizeof("uddg=") - 1) == -1) | |
+ if ((p = strstr(result.url, "uddg="))) { | |
+ p += sizeof("uddg=") - 1; | |
+ if (decodeparam(result.urldecoded, sizeof(result.urlde… | |
result.urldecoded[0] = '\0'; | |
} | |