readability integration

This commit is contained in:
Nazar Kanaev
2020-07-15 21:34:14 +01:00
parent 5d5f95725f
commit ef0e404b90
7 changed files with 2113 additions and 1 deletions

View File

@@ -16,6 +16,7 @@ import (
"math"
"html"
"fmt"
"io/ioutil"
)
func IndexHandler(rw http.ResponseWriter, req *http.Request) {
@@ -472,3 +473,16 @@ func OPMLExportHandler(rw http.ResponseWriter, req *http.Request) {
rw.Write([]byte(builder.String()))
}
}
func PageCrawlHandler(rw http.ResponseWriter, req *http.Request) {
query := req.URL.Query()
if url := query.Get("url"); len(url) > 0 {
res, err := http.Get(url)
if err == nil {
body, err := ioutil.ReadAll(res.Body)
if err == nil {
rw.Write(body)
}
}
}
}