From bfda51433a72e2cd829f5e2c52d954f0b278be62 Mon Sep 17 00:00:00 2001 From: Richard White Date: Sun, 19 Apr 2026 20:52:43 -0500 Subject: [PATCH] update sciam feed names and page order to match print edition --- recipes/scientific_american.recipe | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/recipes/scientific_american.recipe b/recipes/scientific_american.recipe index 07b7c544e4..b3b32cb990 100644 --- a/recipes/scientific_american.recipe +++ b/recipes/scientific_american.recipe @@ -117,10 +117,7 @@ class ScientificAmerican(BasicNewsRecipe): for section in issue_info.get('article_previews', {}): for article in issue_info.get('article_previews', {}).get(section, []): self.log('\t', article['title']) - if section.startswith('featur'): - feed_name = section.capitalize() - else: - feed_name = article['category'] + feed_name = article['column'] if feed_name not in feeds: feeds[feed_name] = [] feeds[feed_name].append( @@ -131,7 +128,9 @@ class ScientificAmerican(BasicNewsRecipe): article['slug'], ), 'description': article['summary'], + 'page_number': int(article['page_number']) } ) - sorted_feeds = dict(sorted(feeds.items(), key=lambda x: (not x[0].startswith('Featur'), x[0]))) + # articles are already sorted by page number within a feed, but feeds are not in order + sorted_feeds = dict(sorted(feeds.items(), key=lambda x: x[1][0]['page_number'])) return sorted_feeds.items()