Implement Parsing of Multiple Articles on one Page #5

Merged
yequari merged 5 commits from multiple-articles-2 into master 2024-04-18 18:55:50 +00:00
1 changed files with 9 additions and 9 deletions
Showing only changes of commit c9e922dd97 - Show all commits

View File

@ -141,15 +141,15 @@ func getTitleAndUrl(article *html.Node) (string, string, error) {
var title string var title string
var url string var url string
var header *html.Node var header *html.Node
h1, _ := getHtmlElement(article, "h1") h1s, _ := getAllElements(article, "h1")
h2, _ := getHtmlElement(article, "h2") h2s, _ := getAllElements(article, "h2")
h3, _ := getHtmlElement(article, "h3") h3s, _ := getAllElements(article, "h3")
if h1 != nil { if len(h1s) > 0 {
header = h1 header = h1s[0]
} else if h2 != nil { } else if len(h2s) > 0 {
header = h2 header = h2s[0]
} else if h3 != nil { } else if len(h3s) > 0 {
header = h3 header = h3s[0]
} }
if header == nil { if header == nil {
return "", "", nil return "", "", nil