description parsing
parent
1c0fc3345e
commit
24e9d3a67d
2
app.go
2
app.go
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue