mirror of
https://github.com/Athou/commafeed.git
synced 2026-09-24 13:05:38 +00:00
add support for declared icons in feeds (#2048)
This commit is contained in:
@@ -69,6 +69,7 @@ public class FeedRefreshWorker {
|
||||
|
||||
feed.setUrlAfterRedirect(urlAfterRedirect);
|
||||
feed.setLink(result.feed().link());
|
||||
feed.setIconUrl(result.feed().iconUrl());
|
||||
feed.setLastModifiedHeader(result.lastModifiedHeader());
|
||||
feed.setEtagHeader(result.lastETagHeader());
|
||||
feed.setLastContentHash(result.contentHash());
|
||||
|
||||
@@ -81,6 +81,7 @@ public class FeedParser {
|
||||
|
||||
String title = feed.getTitle();
|
||||
String link = feed.getLink();
|
||||
String iconUrl = feed.getIcon() != null ? feed.getIcon().getUrl() : null;
|
||||
List<Entry> entries = buildEntries(feed, feedUrl);
|
||||
Instant lastEntryDate = entries.stream().findFirst().map(Entry::published).orElse(null);
|
||||
Instant lastPublishedDate = toValidInstant(feed.getPublishedDate(), false);
|
||||
@@ -89,7 +90,7 @@ public class FeedParser {
|
||||
}
|
||||
Long averageEntryInterval = averageTimeBetweenEntries(entries);
|
||||
|
||||
return new FeedParserResult(title, link, lastPublishedDate, averageEntryInterval, lastEntryDate, entries);
|
||||
return new FeedParserResult(title, link, iconUrl, lastPublishedDate, averageEntryInterval, lastEntryDate, entries);
|
||||
} catch (FeedParsingException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -3,8 +3,8 @@ package com.commafeed.backend.feed.parser;
|
||||
import java.time.Instant;
|
||||
import java.util.List;
|
||||
|
||||
public record FeedParserResult(String title, String link, Instant lastPublishedDate, Long averageEntryInterval, Instant lastEntryDate,
|
||||
List<Entry> entries) {
|
||||
public record FeedParserResult(String title, String link, String iconUrl, Instant lastPublishedDate, Long averageEntryInterval,
|
||||
Instant lastEntryDate, List<Entry> entries) {
|
||||
public record Entry(String guid, String url, Instant published, Content content) {}
|
||||
|
||||
public record Content(String title, String content, String author, String categories, Enclosure enclosure, Media media) {}
|
||||
|
||||
Reference in New Issue
Block a user