From d03b120c41d2558d3ce2a45e049ccbea8785ff7a Mon Sep 17 00:00:00 2001 From: Wasi Master Date: Fri, 18 Sep 2026 03:29:28 +0600 Subject: [PATCH] Fix Freedium fallback for the current mirror layout freedium.cfd no longer resolves, and freedium-mirror.cfd has been rewritten as a SvelteKit app that renders the post inside
rather than the old
. The content check therefore rejected every mirror response, so Medium articles always fell through to the archive fallbacks. Accept either marker, and reject the mirror's error pages explicitly: they return HTTP 200 with a streamed error payload and ship an empty
skeleton, so
alone does not prove a post rendered. Also fix an unrelated crash in process_html_document that blocked this path (and every page with an inline script): get_text() has no "default" keyword, so it raised TypeError. Closes #49 --- app/portable.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/app/portable.py b/app/portable.py index 25e461d..202ab5c 100644 --- a/app/portable.py +++ b/app/portable.py @@ -637,7 +637,7 @@ def process_html_document(html_content, original_url): # Strip anti-hotlinking, anti-embedding, and frame-busting scripts. for script in soup.find_all("script", src=False): - content = script.get_text(default="") + content = script.get_text() # Target the specific hostname check if "location.hostname" in content and ("location.href" in content or "location.replace" in content): @@ -726,6 +726,25 @@ ARCHIVE_PH_MIRRORS = ["archive.ph", "archive.today", "archive.is", "archive.li"] FREEDIUM_MIRRORS = ["freedium-mirror.cfd", "freedium.cfd"] +# The original Freedium layout wrapped the post in
, but +# the current mirror renders it inside a
element instead. Its error pages +# (e.g. "Article not found") still ship an empty
skeleton, so
+# on its own is not proof that the post was rendered. +FREEDIUM_CONTENT_MARKERS = ("main-content", "