[vk] handle photos without width/height info (fixes #2535)

pull/2584/head
Mike Fährmann 2 years ago
parent 9e6c981388
commit a39e7b7366
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -39,9 +39,15 @@ class VkExtractor(Extractor):
self.log.warning("no photo URL found (%s)", photo.get("id"))
continue
photo.update(data)
photo["url"], photo["width"], photo["height"] = photo[size]
try:
photo["url"], photo["width"], photo["height"] = photo[size]
except ValueError:
# photo without width/height entries (#2535)
photo["url"] = photo[size][0]
photo["width"] = photo["height"] = 0
photo["id"] = photo["id"].rpartition("_")[2]
photo.update(data)
text.nameext_from_url(photo["url"], photo)
yield Message.Url, photo["url"], photo
@ -105,7 +111,7 @@ class VkPhotosExtractor(VkExtractor):
},
}),
("https://vk.com/cosplayinrussia", {
"range": "25-35",
"range": "15-25",
"keywords": {
"id": r"re:\d+",
"user": {
@ -117,6 +123,11 @@ class VkPhotosExtractor(VkExtractor):
},
},
}),
# photos without width/height (#2535)
("https://vk.com/id76957806", {
"range": "1-5",
"count": 5,
}),
("https://m.vk.com/albums398982326"),
("https://www.vk.com/id398982326?profile=1"),
("https://vk.com/albums-165740836"),

Loading…
Cancel
Save