@@ -59,17 +59,17 @@ var (
59
59
const userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.4 Safari/605.1.15"
60
60
61
61
// Extract fetches page and retrieves article
62
- func (f UReadability ) Extract (ctx context.Context , reqURL string ) (* Response , error ) {
62
+ func (f * UReadability ) Extract (ctx context.Context , reqURL string ) (* Response , error ) {
63
63
return f .extractWithRules (ctx , reqURL , nil )
64
64
}
65
65
66
66
// ExtractByRule fetches page and retrieves article using a specific rule
67
- func (f UReadability ) ExtractByRule (ctx context.Context , reqURL string , rule * datastore.Rule ) (* Response , error ) {
67
+ func (f * UReadability ) ExtractByRule (ctx context.Context , reqURL string , rule * datastore.Rule ) (* Response , error ) {
68
68
return f .extractWithRules (ctx , reqURL , rule )
69
69
}
70
70
71
71
// ExtractWithRules is the core function that handles extraction with or without a specific rule
72
- func (f UReadability ) extractWithRules (ctx context.Context , reqURL string , rule * datastore.Rule ) (* Response , error ) {
72
+ func (f * UReadability ) extractWithRules (ctx context.Context , reqURL string , rule * datastore.Rule ) (* Response , error ) {
73
73
log .Printf ("[INFO] extract %s" , reqURL )
74
74
rb := & Response {}
75
75
@@ -140,7 +140,7 @@ func (f UReadability) extractWithRules(ctx context.Context, reqURL string, rule
140
140
// getContent retrieves content from raw body string, both content (text only) and rich (with html tags)
141
141
// if rule is provided, it uses custom rule, otherwise tries to retrieve one from the storage,
142
142
// and at last tries to use general readability parser
143
- func (f UReadability ) getContent (ctx context.Context , body , reqURL string , rule * datastore.Rule ) (content , rich string , err error ) {
143
+ func (f * UReadability ) getContent (ctx context.Context , body , reqURL string , rule * datastore.Rule ) (content , rich string , err error ) {
144
144
// general parser
145
145
genParser := func (body , _ string ) (content , rich string , err error ) {
146
146
doc , err := readability .NewDocument (body )
@@ -192,7 +192,7 @@ func (f UReadability) getContent(ctx context.Context, body, reqURL string, rule
192
192
}
193
193
194
194
// makes all links absolute and returns all found links
195
- func (f UReadability ) normalizeLinks (data string , reqContext * http.Request ) (result string , links []string ) {
195
+ func (f * UReadability ) normalizeLinks (data string , reqContext * http.Request ) (result string , links []string ) {
196
196
absoluteLink := func (link string ) (absLink string , changed bool ) {
197
197
if r , err := reqContext .URL .Parse (link ); err == nil {
198
198
return r .String (), r .String () != link
0 commit comments