From b35e79a8079eade5deae6a3606f605da507d769a Mon Sep 17 00:00:00 2001 From: ping Date: Sun, 18 Jun 2023 12:10:17 +0800 Subject: [PATCH] Improve aeon [skip ci] --- recipes/aeon.recipe.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/recipes/aeon.recipe.py b/recipes/aeon.recipe.py index 9e41096c..0a8c519a 100644 --- a/recipes/aeon.recipe.py +++ b/recipes/aeon.recipe.py @@ -75,6 +75,20 @@ def preprocess_raw_html_(self, raw_html, url): date_ele = soup.new_tag("div", attrs={"class": "custom-date-published"}) date_ele.append(f"{published_date:{get_date_format()}}") header.insert_after(date_ele) + + # re-position header image + essay_header = soup.find( + "div", class_=lambda c: c and c.startswith("article__EssayHeader-sc-") + ) + if essay_header: + header_img = essay_header.find("img") + attribution = essay_header.find( + "div", + class_=lambda c: c + and c.startswith("styled__ThumbnailAttributionWrapper-sc-"), + ) + if header_img and attribution: + attribution.insert_before(header_img.extract()) return str(soup) def parse_feeds(self):