googlefs: fix parsed urls
we now get relative URLs it seems...
This commit is contained in:
@@ -43,6 +43,7 @@ int dbgstep = 0;
|
|||||||
#define G_END_SNIPSET "<br>"
|
#define G_END_SNIPSET "<br>"
|
||||||
#define G_BEGIN_CACHESIM " <a class=fl href=\""
|
#define G_BEGIN_CACHESIM " <a class=fl href=\""
|
||||||
#define G_END_CACHESIM "\">"
|
#define G_END_CACHESIM "\">"
|
||||||
|
#define G_URL_PREFIX "http://www.google.com"
|
||||||
|
|
||||||
int google_parse_results(const char *html, size_t htmlsize, long *nextid, struct google_result **results)
|
int google_parse_results(const char *html, size_t htmlsize, long *nextid, struct google_result **results)
|
||||||
{
|
{
|
||||||
@@ -88,6 +89,7 @@ int google_parse_results(const char *html, size_t htmlsize, long *nextid, struct
|
|||||||
char *item;
|
char *item;
|
||||||
long itemlen;
|
long itemlen;
|
||||||
char *tmp;
|
char *tmp;
|
||||||
|
char *urlp;
|
||||||
int i;
|
int i;
|
||||||
#ifdef TESTME
|
#ifdef TESTME
|
||||||
dbgstep = 0;
|
dbgstep = 0;
|
||||||
@@ -119,10 +121,17 @@ int google_parse_results(const char *html, size_t htmlsize, long *nextid, struct
|
|||||||
PRST;
|
PRST;
|
||||||
p+= strlen(G_END_URL);
|
p+= strlen(G_END_URL);
|
||||||
//printf(DBG"[%ld] found token 2\n", numres);
|
//printf(DBG"[%ld] found token 2\n", numres);
|
||||||
itemlen = p - item - strlen(G_END_URL);
|
itemlen = GR_MAX_URL-1;
|
||||||
itemlen = MIN(GR_MAX_URL-1, itemlen);
|
urlp = nres->url;
|
||||||
strncpy(nres->url, item, itemlen);
|
if (!strncmp(item, "/url?", 5)) {
|
||||||
nres->url[itemlen] = '\0';
|
strcpy(urlp, G_URL_PREFIX);
|
||||||
|
itemlen -= strlen(G_URL_PREFIX);
|
||||||
|
urlp += strlen(G_URL_PREFIX);
|
||||||
|
printf("plop\n");
|
||||||
|
}
|
||||||
|
itemlen = MIN(itemlen, p - item - strlen(G_END_URL));
|
||||||
|
strncpy(urlp, item, itemlen);
|
||||||
|
urlp[itemlen] = '\0';
|
||||||
|
|
||||||
/* find name */
|
/* find name */
|
||||||
//<b>Google</b> Web APIs - FAQ</a><table
|
//<b>Google</b> Web APIs - FAQ</a><table
|
||||||
|
|||||||
Reference in New Issue
Block a user