[bellazon] remove query parameters from attachment IDs (#8544)

This commit is contained in:
Mike Fährmann
2025-11-12 11:29:17 +01:00
parent b6f855d3f3
commit da47214ca0
2 changed files with 16 additions and 1 deletions

View File

@@ -72,7 +72,8 @@ class BellazonExtractor(Extractor):
dc["extension"] = ext
elif "/core/interface/file/attachment.php" in url:
if not dc["id"]:
dc["id"] = url.rpartition("?id=")[2]
dc["id"] = \
url.rpartition("?id=")[2].partition("&")[0]
if name := text.extr(info, ">", "<").strip():
text.nameext_from_url(name, dc)

View File

@@ -223,6 +223,20 @@ __tests__ = (
"#count" : 0,
},
{
"#url" : "https://www.bellazon.com/main/topic/4322-candids/page/1852/#comment-5902385",
"#comment" : "attachment 'id' with query parameters (#8544)",
"#class" : bellazon.BellazonPostExtractor,
"#range" : "4",
"#results" : "https://www.bellazon.com/main/applications/core/interface/file/attachment.php?id=14418097&key=491d27ee2482b1808483f1d544873b06",
"count" : 4,
"num" : 4,
"filename" : "download",
"extension" : "jfif",
"id" : "14418097",
},
{
"#url" : "https://www.bellazon.com/main/topic/57872-millie-brady/",
"#class" : bellazon.BellazonThreadExtractor,