[imagebam] fix 'filename' & 'extension' for names without ext (#8476)

This commit is contained in:
Mike Fährmann
2025-10-29 09:13:02 +01:00
parent 5ab0c6051b
commit f692380950
2 changed files with 14 additions and 4 deletions

View File

@@ -30,12 +30,10 @@ class ImagebamExtractor(Extractor):
url, pos = text.extract(page, '<img src="https://images', '"')
filename = text.unescape(text.extract(page, 'alt="', '"', pos)[0])
data = {
return text.nameext_from_name(filename, {
"url" : "https://images" + url,
"image_key": path.rpartition("/")[2],
}
data["filename"], _, data["extension"] = filename.rpartition(".")
return data
})
class ImagebamGalleryExtractor(ImagebamExtractor):

View File

@@ -75,4 +75,16 @@ __tests__ = (
"#sha1_content" : "f81008666b17a42d8834c4749b910e1dc10a6e83",
},
{
"#url" : "https://www.imagebam.com/image/b728aa119132443",
"#comment" : "filename without extension (#8476)",
"#class" : imagebam.ImagebamImageExtractor,
"#results" : "https://images3.imagebam.com/d2/7a/d9/b728aa119132443.jpg",
"extension": "",
"filename" : "34415_AlessandraAmbrosio_PhotoshootforVictoriasSecretwearingbikinislingerieonthebeachinMalibuCalifor",
"image_key": "b728aa119132443",
"url" : "https://images3.imagebam.com/d2/7a/d9/b728aa119132443.jpg",
},
)