From ba8180b5e612dad844bb84a135ae48cd0e277f1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sat, 24 Apr 2021 01:47:44 +0200 Subject: [PATCH] [bcy] don't crash with deleted posts --- gallery_dl/extractor/bcy.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/gallery_dl/extractor/bcy.py b/gallery_dl/extractor/bcy.py index 6e0003d2..d6e3683c 100644 --- a/gallery_dl/extractor/bcy.py +++ b/gallery_dl/extractor/bcy.py @@ -170,11 +170,16 @@ class BcyPostExtractor(BcyExtractor): }, }), # only watermarked images available - ("https://bcy.net/item/detail/6780546160802143236", { + ("https://bcy.net/item/detail/6950136331708144648", { "pattern": r"https://p\d-bcy.byteimg.com/img/banciyuan/[0-9a-f]+" r"~tplv-banciyuan-logo-v3:.+\.image", - "count": 8, + "count": 10, "keyword": {"filter": "watermark"} + + }), + # deleted + ("https://bcy.net/item/detail/6780546160802143236", { + "count": 0, }), # only visible to logged in users ("https://bcy.net/item/detail/6747523535150783495", { @@ -183,7 +188,10 @@ class BcyPostExtractor(BcyExtractor): ) def posts(self): - data = self._data_from_post(self.item_id) + try: + data = self._data_from_post(self.item_id) + except KeyError: + return () post = data["post_data"] post["image_list"] = post["multi"] post["plain"] = text.parse_unicode_escapes(post["plain"])