[imagebam] fix 'filename' & 'extension' for names without ext (#8476)
This commit is contained in:
@@ -30,12 +30,10 @@ class ImagebamExtractor(Extractor):
|
|||||||
url, pos = text.extract(page, '<img src="https://images', '"')
|
url, pos = text.extract(page, '<img src="https://images', '"')
|
||||||
filename = text.unescape(text.extract(page, 'alt="', '"', pos)[0])
|
filename = text.unescape(text.extract(page, 'alt="', '"', pos)[0])
|
||||||
|
|
||||||
data = {
|
return text.nameext_from_name(filename, {
|
||||||
"url" : "https://images" + url,
|
"url" : "https://images" + url,
|
||||||
"image_key": path.rpartition("/")[2],
|
"image_key": path.rpartition("/")[2],
|
||||||
}
|
})
|
||||||
data["filename"], _, data["extension"] = filename.rpartition(".")
|
|
||||||
return data
|
|
||||||
|
|
||||||
|
|
||||||
class ImagebamGalleryExtractor(ImagebamExtractor):
|
class ImagebamGalleryExtractor(ImagebamExtractor):
|
||||||
|
|||||||
@@ -75,4 +75,16 @@ __tests__ = (
|
|||||||
"#sha1_content" : "f81008666b17a42d8834c4749b910e1dc10a6e83",
|
"#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",
|
||||||
|
},
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user