sync of changes
This commit is contained in:
25
pkg/extractor/goose.go
Normal file
25
pkg/extractor/goose.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package extractor
|
||||
|
||||
import (
|
||||
"context"
|
||||
goose "github.com/advancedlogic/GoOse"
|
||||
)
|
||||
|
||||
type GooseExtractor struct {
|
||||
}
|
||||
|
||||
func (GooseExtractor) Extract(ctx context.Context, url string) (Article, error) {
|
||||
var res = Article{
|
||||
URL: url,
|
||||
}
|
||||
g := goose.New()
|
||||
|
||||
article, err := g.ExtractFromURL(url)
|
||||
if err != nil {
|
||||
return res, err
|
||||
}
|
||||
|
||||
res.Body = article.CleanedText
|
||||
res.Title = article.Title
|
||||
return res, nil
|
||||
}
|
Reference in New Issue
Block a user