Only extract the first element as title
This commit is contained in:
@@ -7,7 +7,6 @@ package readability
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"golang.org/x/text/encoding/htmlindex"
|
||||
"io"
|
||||
"log"
|
||||
"math"
|
||||
@@ -15,6 +14,8 @@ import (
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/text/encoding/htmlindex"
|
||||
|
||||
"github.com/PuerkitoBio/goquery"
|
||||
"golang.org/x/net/html"
|
||||
)
|
||||
@@ -129,7 +130,7 @@ func readDocumentWithEncoding(content []byte) (*goquery.Document, error) {
|
||||
}
|
||||
|
||||
func getTitle(document *goquery.Document) string {
|
||||
title := document.Find("title").Text()
|
||||
title := document.Find("title").First().Text()
|
||||
return title
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user