From e660e48a6071bb81417f697c7255069263dae275 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Wed, 27 Jul 2022 18:52:43 +0200 Subject: [PATCH] [vk] prevent exceptions for broken/invalid photos (#2774) --- gallery_dl/extractor/vk.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gallery_dl/extractor/vk.py b/gallery_dl/extractor/vk.py index ab2153f1..25b00fe3 100644 --- a/gallery_dl/extractor/vk.py +++ b/gallery_dl/extractor/vk.py @@ -39,13 +39,18 @@ class VkExtractor(Extractor): self.log.warning("no photo URL found (%s)", photo.get("id")) continue + try: + photo["url"] = photo[size + "src"] + except KeyError: + self.log.warning("no photo URL found (%s)", photo.get("id")) + continue + try: _, photo["width"], photo["height"] = photo[size] except ValueError: # photo without width/height entries (#2535) photo["width"] = photo["height"] = 0 - photo["url"] = photo[size + "src"] photo["id"] = photo["id"].rpartition("_")[2] photo.update(data)