Keep the publication an article's page declares

Readability already reads og:site_name and JSON-LD publisher.name; carry
that through Page and Extracted and store it in articles.publication, the
same way the page byline is kept. `publication_label` is what the readers
will see after the feed name: the site name, else the domain, and nothing
when it would only repeat the feed's own title.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YWmCpUojfHXhSZ2129Z7Nv
This commit is contained in:
2026-09-09 05:48:46 +00:00
co-authored by Claude Fable 5.1
parent c8df55e91a
commit f71a4c2799
16 changed files with 161 additions and 37 deletions
+5
View File
@@ -167,6 +167,7 @@ fn imported_article(
first_seen,
url: page.final_url,
author: extracted.author,
publication: extracted.publication,
feed_id: 0,
feed_title: "Imported".into(),
category: None,
@@ -379,6 +380,7 @@ mod tests {
first_seen: now,
url: url.into(),
author: None,
publication: None,
feed_id: 7,
feed_title: "Feed".into(),
category: None,
@@ -484,6 +486,7 @@ mod tests {
title: "A historical essay".into(),
html: "<article><p>Useful old writing.</p><script>bad()</script><img src=\"/chart.png\"></article>".into(),
author: Some("Essay Writer".into()),
site_name: Some("Example Review".into()),
final_url: "https://example.com/essays/old".into(),
};
let extracted = extractor.finish_readable("https://example.com/old", &page);
@@ -497,6 +500,7 @@ mod tests {
assert_eq!(article.best_entry_id, 0);
assert_eq!(article.feed_title, "Imported");
assert_eq!(article.author.as_deref(), Some("Essay Writer"));
assert_eq!(article.publication.as_deref(), Some("Example Review"));
assert!(article.sources.is_empty());
assert!(!article.content_html.contains("script"));
assert_eq!(article.image_urls, ["https://example.com/chart.png"]);
@@ -506,6 +510,7 @@ mod tests {
assert_eq!(loaded.best_entry_id, 0);
assert_eq!(loaded.feed_title, "Imported");
assert_eq!(loaded.author.as_deref(), Some("Essay Writer"));
assert_eq!(loaded.publication.as_deref(), Some("Example Review"));
}
#[tokio::test]