From e61dc42d3c991bcce08e1ddd24c86d50bc6d268b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alo=C3=AFs=20Micard?= Date: Tue, 22 Sep 2020 17:08:24 +0200 Subject: [PATCH] Some cleanup --- README.md | 2 +- internal/extractor/extractor.go | 3 +-- internal/trandoshanctl/trandoshanctl.go | 4 ++++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index cec6b2e..0310444 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Ensure you have at least 3GB of memory as the Elasticsearch stack docker will re # How to start the crawling process -Since the API is explosed on localhost:15005, one can use it to start the crawling process: +Since the API is exposed on localhost:15005, one can use it to start the crawling process: using trandoshanctl executable: diff --git a/internal/extractor/extractor.go b/internal/extractor/extractor.go index e4459a7..14233d8 100644 --- a/internal/extractor/extractor.go +++ b/internal/extractor/extractor.go @@ -84,7 +84,7 @@ func handleMessage(apiClient api.Client) natsutil.MsgHandler { // Extract & process resource resDto, urls, err := extractResource(resMsg) if err != nil { - log.Err(err).Msg("Ersror while extracting resource") + log.Err(err).Msg("Error while extracting resource") return err } @@ -148,7 +148,6 @@ func extractTitle(body string) string { return "" } - // TODO improve startPos := strings.Index(cleanBody, "") + len("<title>") endPos := strings.Index(cleanBody, "") diff --git a/internal/trandoshanctl/trandoshanctl.go b/internal/trandoshanctl/trandoshanctl.go index 2490a79..488471b 100644 --- a/internal/trandoshanctl/trandoshanctl.go +++ b/internal/trandoshanctl/trandoshanctl.go @@ -73,6 +73,10 @@ func search(c *cli.Context) error { return err } + if len(res) == 0 { + fmt.Println("No resources crawled (yet).") + } + for _, r := range res { fmt.Printf("%s - %s\n", r.URL, r.Title) }