description parsing

main
ColumbusUtrigas 2022-08-21 08:24:47 +04:00
parent 1c0fc3345e
commit 24e9d3a67d
2 changed files with 4 additions and 4 deletions

2
app.go
View File

@ -20,7 +20,7 @@ type RssEntry struct {
} }
type Parser interface { type Parser interface {
Parse() []RssEntry Parse() []*RssEntry
Title() string Title() string
Description() string Description() string

View File

@ -11,8 +11,8 @@ import (
type NvidiaParser struct { type NvidiaParser struct {
} }
func (this NvidiaParser) Parse() []RssEntry { func (this NvidiaParser) Parse() []*RssEntry {
var result []RssEntry var result []*RssEntry
resp, err := http.Get(this.RootUrl() + "/publications") resp, err := http.Get(this.RootUrl() + "/publications")
if err != nil { if err != nil {
@ -25,7 +25,7 @@ func (this NvidiaParser) Parse() []RssEntry {
link := s.Find("a") link := s.Find("a")
href, exists := link.Attr("href") href, exists := link.Attr("href")
if exists { if exists {
result = append(result, RssEntry{title: link.Text(), url: this.RootUrl() + href}) result = append(result, &RssEntry{title: link.Text(), url: this.RootUrl() + href})
} }
}) })