From 058cc47e9b94415d77badc372b8acffe3845404b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sun, 28 Mar 2021 23:08:26 +0200 Subject: [PATCH] [bcy] improve pagination --- gallery_dl/extractor/bcy.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/gallery_dl/extractor/bcy.py b/gallery_dl/extractor/bcy.py index ec7020a9..6e0003d2 100644 --- a/gallery_dl/extractor/bcy.py +++ b/gallery_dl/extractor/bcy.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Mike Fährmann +# Copyright 2020-2021 Mike Fährmann # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as @@ -125,12 +125,15 @@ class BcyUserExtractor(BcyExtractor): while True: data = self.request(url, params=params).json() - item = None - for item in data["data"]["items"]: - yield item["item_detail"] - - if not item: + try: + items = data["data"]["items"] + except KeyError: return + if not items: + return + + for item in items: + yield item["item_detail"] params["since"] = item["since"]