From e5920259b6302c119c647a440cb944f054dee38c Mon Sep 17 00:00:00 2001 From: Nazar Kanaev Date: Tue, 30 Mar 2021 11:47:36 +0100 Subject: [PATCH] start rewriting readability --- bin/reader.go | 29 ++++++++++ src/htmlutil/query.go | 76 ++++++++++++++++++++++++++ src/htmlutil/query_test.go | 64 ++++++++++++++++++++++ src/htmlutil/utils.go | 33 +++++++++++ src/{scraper => reader}/readability.go | 26 ++++----- src/scraper/finder.go | 36 +++++++----- src/scraper/sanitizer.go | 2 +- src/scraper/utils.go | 41 -------------- 8 files changed, 238 insertions(+), 69 deletions(-) create mode 100644 bin/reader.go create mode 100644 src/htmlutil/query.go create mode 100644 src/htmlutil/query_test.go create mode 100644 src/htmlutil/utils.go rename src/{scraper => reader}/readability.go (96%) diff --git a/bin/reader.go b/bin/reader.go new file mode 100644 index 0000000..e3358bd --- /dev/null +++ b/bin/reader.go @@ -0,0 +1,29 @@ +package main + +import ( + "fmt" + "log" + "net/http" + "os" + + "github.com/nkanaev/yarr/src/reader" +) + +func main() { + if len(os.Args) != 2 { + fmt.Println("usage: