Unwrap Scour's /r/rss/ redirector when canonicalizing URLs
Scour interest feeds link every entry through https://scour.ing/r/rss/<percent-encoded article URL>, so the wrapper became the article's canonical URL: the same post arriving via Hacker News and Scour never merged, and the publication fallback showed "scour.ing" instead of the site's own domain. Resolve the wrapper like the Google News redirector. `publication_label` re-canonicalizes the stored URL so the 477 articles saved with the wrapper show the real domain too. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VXYGBPoHZSDSfE5WcJ9bvj
This commit is contained in:
+16
-1
@@ -160,7 +160,14 @@ impl Article {
|
||||
let publication = self
|
||||
.publication
|
||||
.clone()
|
||||
.or_else(|| domain(&self.canonical_url))?;
|
||||
// Covers rows stored before Scour wrappers were unwrapped.
|
||||
.or_else(|| {
|
||||
domain(
|
||||
crate::dedupe::canonical_url(&self.canonical_url)
|
||||
.as_deref()
|
||||
.unwrap_or(&self.canonical_url),
|
||||
)
|
||||
})?;
|
||||
(!publication
|
||||
.trim()
|
||||
.eq_ignore_ascii_case(self.feed_title.trim()))
|
||||
@@ -914,6 +921,14 @@ mod tests {
|
||||
assert_eq!(article.publication_label().as_deref(), Some("example.com"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn publication_label_unwraps_stored_scour_urls() {
|
||||
let mut article = publication_article();
|
||||
article.canonical_url =
|
||||
"https://scour.ing/r/rss/https%3A%2F%2Fwww.example.com%2Fpost".into();
|
||||
assert_eq!(article.publication_label().as_deref(), Some("example.com"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn publication_label_omits_a_publication_matching_the_feed() {
|
||||
let mut article = publication_article();
|
||||
|
||||
Reference in New Issue
Block a user