mirror of
https://github.com/miniflux/v2.git
synced 2025-07-27 17:28:38 +00:00
Use image included in feed as feed icon
This commit is contained in:
parent
228bb62df4
commit
1aeb1b20da
8 changed files with 92 additions and 28 deletions
|
@ -18,6 +18,11 @@ func TestParseRss2Sample(t *testing.T) {
|
|||
<title>Liftoff News</title>
|
||||
<link>http://liftoff.msfc.nasa.gov/</link>
|
||||
<description>Liftoff to Space Exploration.</description>
|
||||
<image>
|
||||
<url>http://liftoff.msfc.nasa.gov/HomePageXtra/MeatBall.gif</url>
|
||||
<title>NASA</title>
|
||||
<link>http://liftoff.msfc.nasa.gov/</link>
|
||||
</image>
|
||||
<language>en-us</language>
|
||||
<pubDate>Tue, 10 Jun 2003 04:00:00 GMT</pubDate>
|
||||
<lastBuildDate>Tue, 10 Jun 2003 09:41:01 GMT</lastBuildDate>
|
||||
|
@ -71,6 +76,10 @@ func TestParseRss2Sample(t *testing.T) {
|
|||
t.Errorf("Incorrect site URL, got: %s", feed.SiteURL)
|
||||
}
|
||||
|
||||
if feed.IconURL != "http://liftoff.msfc.nasa.gov/HomePageXtra/MeatBall.gif" {
|
||||
t.Errorf("Incorrect image URL, got: %s", feed.IconURL)
|
||||
}
|
||||
|
||||
if len(feed.Entries) != 4 {
|
||||
t.Errorf("Incorrect number of entries, got: %d", len(feed.Entries))
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ type rssFeed struct {
|
|||
Version string `xml:"version,attr"`
|
||||
Title string `xml:"channel>title"`
|
||||
Links []rssLink `xml:"channel>link"`
|
||||
ImageURL string `xml:"channel>image>url"`
|
||||
Language string `xml:"channel>language"`
|
||||
Description string `xml:"channel>description"`
|
||||
PubDate string `xml:"channel>pubDate"`
|
||||
|
@ -58,6 +59,8 @@ func (r *rssFeed) Transform(baseURL string) *model.Feed {
|
|||
feed.Title = feed.SiteURL
|
||||
}
|
||||
|
||||
feed.IconURL = strings.TrimSpace(r.ImageURL)
|
||||
|
||||
for _, item := range r.Items {
|
||||
entry := item.Transform()
|
||||
if entry.Author == "" {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue