|
|
|
@ -18,6 +18,7 @@ import (
|
|
|
|
"sync"
|
|
|
|
"sync"
|
|
|
|
"time"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/PuerkitoBio/goquery"
|
|
|
|
"github.com/tidwall/gjson"
|
|
|
|
"github.com/tidwall/gjson"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
@ -597,6 +598,14 @@ var customAPITemplateFuncs = func() template.FuncMap {
|
|
|
|
|
|
|
|
|
|
|
|
return getCachedRegexp(pattern).ReplaceAllString(s, replacement)
|
|
|
|
return getCachedRegexp(pattern).ReplaceAllString(s, replacement)
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
"parseHTML": func(body string) *goquery.Document {
|
|
|
|
|
|
|
|
doc, err := goquery.NewDocumentFromReader(strings.NewReader(body))
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return doc
|
|
|
|
|
|
|
|
},
|
|
|
|
"findMatch": func(pattern, s string) string {
|
|
|
|
"findMatch": func(pattern, s string) string {
|
|
|
|
if s == "" {
|
|
|
|
if s == "" {
|
|
|
|
return ""
|
|
|
|
return ""
|
|
|
|
|