diff options
| author | Felix Perktold <Felix.Perktold@student.uibk.ac.at> | 2026-07-22 14:45:45 +0200 |
|---|---|---|
| committer | Felix Perktold <Felix.Perktold@student.uibk.ac.at> | 2026-07-22 14:45:45 +0200 |
| commit | ab9bb3793d7885387f6552912fedf85b1eba95a6 (patch) | |
| tree | 968aae74a76319174107785a78f12399929fc1f8 | |
| parent | ba8dc86ac7768066e5ae3d86051fc0c02d25ed20 (diff) | |
| -rw-r--r-- | main.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -199,6 +199,7 @@ static size_t curl_callback(char *str, size_t size, size_t nmemb, void *ctx) { memcpy(buf, str, n); buf[n] = '\0'; char *cursor = buf; + regmatch_t match; // look for urls @@ -208,7 +209,11 @@ static size_t curl_callback(char *str, size_t size, size_t nmemb, void *ctx) { memcpy(url, cursor + match.rm_so, len); url[len] = '\0'; - //printf("found url: %s\n", url); + if (len > 300) { + free(url); + cursor += match.rm_eo; + continue; + } //insert url into db int inserted = db_insert_url(db, url); @@ -277,7 +282,7 @@ int main(void) { fill_queue(DB); //init regex - const char *pattern = "https?://[^[:space:]\"<>#]+"; + const char *pattern = "https?://[^[:space:]\"'<>#?]+"; if (regcomp(®ex, pattern, REG_EXTENDED) != 0) { printf("Failed to compile regex\n"); return 1; |
